@@ -82,6 +82,7 @@ namespace NBalancing {
82
82
TBatchManager BatchManager;
83
83
84
84
TInstant StartTime;
85
+ bool AquiredReplToken = false ;
85
86
86
87
// /////////////////////////////////////////////////////////////////////////////////////////
87
88
// Init logic
@@ -220,6 +221,8 @@ namespace NBalancing {
220
221
}
221
222
222
223
void ScheduleJobQuant () {
224
+ Y_DEBUG_ABORT_UNLESS (!AquiredReplToken);
225
+ AquiredReplToken = true ;
223
226
Ctx->MonGroup .ReplTokenAquired ()++;
224
227
225
228
// once repl token received, start balancing - waking up sender and deleter
@@ -240,13 +243,14 @@ namespace NBalancing {
240
243
241
244
if (StartTime + Ctx->Cfg .EpochTimeout < TlsActivationContext->Now ()) {
242
245
Ctx->MonGroup .EpochTimeouts ()++;
243
- Send (MakeBlobStorageReplBrokerID (), new TEvReleaseReplToken);
244
246
STLOG (PRI_INFO, BS_VDISK_BALANCING, BSVB04, VDISKP (Ctx->VCtx , " Epoch timeout" ));
245
247
Stop (TDuration::Seconds (0 ));
246
248
return ;
247
249
}
248
250
249
251
if (BatchManager.IsBatchCompleted ()) {
252
+ Y_DEBUG_ABORT_UNLESS (AquiredReplToken);
253
+ AquiredReplToken = false ;
250
254
Send (MakeBlobStorageReplBrokerID (), new TEvReleaseReplToken);
251
255
252
256
ContinueBalancing ();
@@ -320,6 +324,10 @@ namespace NBalancing {
320
324
void Stop (TDuration timeoutBeforeNextLaunch) {
321
325
STLOG (PRI_INFO, BS_VDISK_BALANCING, BSVB12, VDISKP (Ctx->VCtx , " Stop balancing" ), (SendOnMainParts, SendOnMainParts.Data .size ()), (TryDeleteParts, TryDeleteParts.Data .size ()), (SecondsBeforeNextLaunch, timeoutBeforeNextLaunch.Seconds ()));
322
326
327
+ if (AquiredReplToken) {
328
+ Send (MakeBlobStorageReplBrokerID (), new TEvReleaseReplToken);
329
+ }
330
+
323
331
Send (BatchManager.SenderId , new NActors::TEvents::TEvPoison);
324
332
Send (BatchManager.DeleterId , new NActors::TEvents::TEvPoison);
325
333
for (const auto & kv : *QueueActorMapPtr) {
0 commit comments