Skip to content
Merged
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
10 changes: 9 additions & 1 deletion ydb/core/blobstorage/vdisk/balance/balancing_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ namespace NBalancing {
TBatchManager BatchManager;

TInstant StartTime;
bool AquiredReplToken = false;

///////////////////////////////////////////////////////////////////////////////////////////
// Init logic
Expand Down Expand Up @@ -220,6 +221,8 @@ namespace NBalancing {
}

void ScheduleJobQuant() {
Y_DEBUG_ABORT_UNLESS(!AquiredReplToken);
AquiredReplToken = true;
Ctx->MonGroup.ReplTokenAquired()++;

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

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

if (BatchManager.IsBatchCompleted()) {
Y_DEBUG_ABORT_UNLESS(AquiredReplToken);
AquiredReplToken = false;
Send(MakeBlobStorageReplBrokerID(), new TEvReleaseReplToken);

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

if (AquiredReplToken) {
Send(MakeBlobStorageReplBrokerID(), new TEvReleaseReplToken);
}

Send(BatchManager.SenderId, new NActors::TEvents::TEvPoison);
Send(BatchManager.DeleterId, new NActors::TEvents::TEvPoison);
for (const auto& kv : *QueueActorMapPtr) {
Expand Down