Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add delay before shutdown #9688

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ydb/core/driver_lib/run/run.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,9 @@ static TString ReadFile(const TString& fileName) {
void TKikimrRunner::InitializeGracefulShutdown(const TKikimrRunConfig& runConfig) {
Y_UNUSED(runConfig);
GracefulShutdownSupported = true;
if (runConfig.AppConfig.HasDelayBeforeShutdownSeconds()) {
DelayBeforeShutdown = TDuration::Seconds(runConfig.AppConfig.GetDelayBeforeShutdownSeconds());
}
}

void TKikimrRunner::InitializeKqpController(const TKikimrRunConfig& runConfig) {
Expand Down Expand Up @@ -1732,6 +1735,7 @@ void TKikimrRunner::KikimrStop(bool graceful) {

if (EnabledGrpcService) {
ActorSystem->Send(new IEventHandle(NGRpcService::CreateGrpcPublisherServiceActorId(), {}, new TEvents::TEvPoisonPill));
Sleep(DelayBeforeShutdown);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно дрейнить сессии и таблетки, но нельзя тушить актор-систему, если с начала KikimrStop() прошло меньше, чем DelayBeforeShutdown секунд. Да и саму настройку в таком случае можно переименовать, потому эта задерэка не безусловная.

}

TIntrusivePtr<TDrainProgress> drainProgress(new TDrainProgress());
Expand Down
1 change: 1 addition & 0 deletions ydb/core/driver_lib/run/run.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class TKikimrRunner : public virtual TThrRefBase, private IGlobalObjectStorage {

bool EnabledGrpcService = false;
bool GracefulShutdownSupported = false;
TDuration DelayBeforeShutdown;
THolder<NSQS::TAsyncHttpServer> SqsHttp;

THolder<NYdb::TDriver> YdbDriver;
Expand Down
1 change: 1 addition & 0 deletions ydb/core/protos/config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1989,6 +1989,7 @@ message TAppConfig {
optional TMemoryControllerConfig MemoryControllerConfig = 81;
optional TGroupedMemoryLimiterConfig GroupedMemoryLimiterConfig = 82;
optional NKikimrReplication.TReplicationDefaults ReplicationConfig = 83;
optional uint32 DelayBeforeShutdownSeconds = 84;

repeated TNamedConfig NamedConfigs = 100;
optional string ClusterYamlConfig = 101;
Expand Down
Loading