Skip to content

Commit bbfffb3

Browse files
committed
impl drain timeout config (#19323) (#19399)
1 parent 61c6bc5 commit bbfffb3

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

ydb/core/driver_lib/run/run.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,10 +519,14 @@ static TString ReadFile(const TString& fileName) {
519519

520520
void TKikimrRunner::InitializeGracefulShutdown(const TKikimrRunConfig& runConfig) {
521521
GracefulShutdownSupported = true;
522+
DrainTimeout = TDuration::Seconds(30);
522523
const auto& config = runConfig.AppConfig.GetShutdownConfig();
523524
if (config.HasMinDelayBeforeShutdownSeconds()) {
524525
MinDelayBeforeShutdown = TDuration::Seconds(config.GetMinDelayBeforeShutdownSeconds());
525526
}
527+
if (config.HasDrainTimeoutSeconds()) {
528+
DrainTimeout = TDuration::Seconds(config.GetDrainTimeoutSeconds());
529+
}
526530
}
527531

528532
void TKikimrRunner::InitializeKqpController(const TKikimrRunConfig& runConfig) {
@@ -1875,7 +1879,8 @@ void TKikimrRunner::KikimrStop(bool graceful) {
18751879
DisableActorCallstack();
18761880

18771881
if (drainProgress) {
1878-
for (ui32 i = 0; i < 300; i++) {
1882+
ui32 maxTicks = DrainTimeout.MilliSeconds() / 100;
1883+
for (ui32 i = 0; i < maxTicks; i++) {
18791884
auto cnt = drainProgress->GetOnlineTabletsEstimate();
18801885
if (cnt > 0) {
18811886
Cerr << "Waiting for drain to complete: " << cnt << " tablets are online on node." << Endl;

ydb/core/driver_lib/run/run.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class TKikimrRunner : public virtual TThrRefBase, private IGlobalObjectStorage {
4444
bool EnabledGrpcService = false;
4545
bool GracefulShutdownSupported = false;
4646
TDuration MinDelayBeforeShutdown;
47+
TDuration DrainTimeout;
4748
THolder<NSQS::TAsyncHttpServer> SqsHttp;
4849

4950
THolder<NYdb::TDriver> YdbDriver;

ydb/core/protos/config.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2215,6 +2215,7 @@ message TMetadataCacheConfig {
22152215

22162216
message TShutdownConfig {
22172217
optional uint32 MinDelayBeforeShutdownSeconds = 1;
2218+
optional uint32 DrainTimeoutSeconds = 2;
22182219
}
22192220

22202221
message TLabel {

0 commit comments

Comments
 (0)