Skip to content

Commit ce8c6eb

Browse files
authored
Fix release repl token after poisson pill (#10069)
1 parent 82cbbe7 commit ce8c6eb

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

ydb/core/blobstorage/vdisk/balance/balancing_actor.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ namespace NBalancing {
8282
TBatchManager BatchManager;
8383

8484
TInstant StartTime;
85+
bool AquiredReplToken = false;
8586

8687
///////////////////////////////////////////////////////////////////////////////////////////
8788
// Init logic
@@ -220,6 +221,8 @@ namespace NBalancing {
220221
}
221222

222223
void ScheduleJobQuant() {
224+
Y_DEBUG_ABORT_UNLESS(!AquiredReplToken);
225+
AquiredReplToken = true;
223226
Ctx->MonGroup.ReplTokenAquired()++;
224227

225228
// once repl token received, start balancing - waking up sender and deleter
@@ -240,13 +243,14 @@ namespace NBalancing {
240243

241244
if (StartTime + Ctx->Cfg.EpochTimeout < TlsActivationContext->Now()) {
242245
Ctx->MonGroup.EpochTimeouts()++;
243-
Send(MakeBlobStorageReplBrokerID(), new TEvReleaseReplToken);
244246
STLOG(PRI_INFO, BS_VDISK_BALANCING, BSVB04, VDISKP(Ctx->VCtx, "Epoch timeout"));
245247
Stop(TDuration::Seconds(0));
246248
return;
247249
}
248250

249251
if (BatchManager.IsBatchCompleted()) {
252+
Y_DEBUG_ABORT_UNLESS(AquiredReplToken);
253+
AquiredReplToken = false;
250254
Send(MakeBlobStorageReplBrokerID(), new TEvReleaseReplToken);
251255

252256
ContinueBalancing();
@@ -320,6 +324,10 @@ namespace NBalancing {
320324
void Stop(TDuration timeoutBeforeNextLaunch) {
321325
STLOG(PRI_INFO, BS_VDISK_BALANCING, BSVB12, VDISKP(Ctx->VCtx, "Stop balancing"), (SendOnMainParts, SendOnMainParts.Data.size()), (TryDeleteParts, TryDeleteParts.Data.size()), (SecondsBeforeNextLaunch, timeoutBeforeNextLaunch.Seconds()));
322326

327+
if (AquiredReplToken) {
328+
Send(MakeBlobStorageReplBrokerID(), new TEvReleaseReplToken);
329+
}
330+
323331
Send(BatchManager.SenderId, new NActors::TEvents::TEvPoison);
324332
Send(BatchManager.DeleterId, new NActors::TEvents::TEvPoison);
325333
for (const auto& kv : *QueueActorMapPtr) {

0 commit comments

Comments
 (0)