diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_put.cpp b/ydb/core/blobstorage/dsproxy/dsproxy_put.cpp index a03fc5f86ffb..6e7cdd31419a 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_put.cpp +++ b/ydb/core/blobstorage/dsproxy/dsproxy_put.cpp @@ -138,7 +138,7 @@ class TBlobStorageGroupPutRequest : public TBlobStorageGroupRequestActorDonorMode < record.Config.HasDonorMode() || record.RuntimeData->ReadOnly != record.Config.GetReadOnly()) { PoisonLocalVDisk(record); - StartLocalVDiskActor(record, PDISK_CONFIDENCE_DELAY); + StartLocalVDiskActor(record, VDiskCooldownTimeout); } } @@ -323,7 +321,7 @@ namespace NKikimr::NStorage { auto& record = it->second; if (record.GetVDiskId() == vDiskId) { PoisonLocalVDisk(record); - StartLocalVDiskActor(record, PDISK_CONFIDENCE_DELAY); + StartLocalVDiskActor(record, VDiskCooldownTimeout); break; } } diff --git a/ydb/core/blobstorage/vdisk/localrecovery/localrecovery_public.cpp b/ydb/core/blobstorage/vdisk/localrecovery/localrecovery_public.cpp index 6a9dfb41a58b..e0260d99201c 100644 --- a/ydb/core/blobstorage/vdisk/localrecovery/localrecovery_public.cpp +++ b/ydb/core/blobstorage/vdisk/localrecovery/localrecovery_public.cpp @@ -82,8 +82,6 @@ namespace NKikimr { bool HugeKeeperInitialized = false; ui64 RecoveredLsn = 0; ui64 SyncLogMaxLsnStored = 0; - bool CooldownTimerHit = false; - bool DatabaseLoaded = false; NKikimrVDiskData::TScrubEntrypoint ScrubEntrypoint; ui64 ScrubEntrypointLsn = 0; @@ -215,11 +213,8 @@ namespace NKikimr { ActiveActors.Erase(ev->Sender); auto *msg = ev->Get(); RecoveredLsn = msg->RecoveredLsn; - if (RecoveredLsn) { - CooldownTimerHit = true; // we do not apply cooldown timer when there are entries in the log - } if (msg->Status == NKikimrProto::OK) { - PostReplayRecoveryLog(ctx); + SignalSuccessAndDie(ctx); } else { SignalErrorAndDie(ctx, msg->Status, msg->ErrorReason); } @@ -560,19 +555,6 @@ namespace NKikimr { AfterDatabaseLoaded(ctx); } } - void PostReplayRecoveryLog(const TActorContext &ctx) { - DatabaseLoaded = true; - if (DatabaseLoaded && CooldownTimerHit) { - SignalSuccessAndDie(ctx); - } - } - - void HandleWakeup(const TActorContext &ctx) { - CooldownTimerHit = true; - if (DatabaseLoaded && CooldownTimerHit) { - SignalSuccessAndDie(ctx); - } - } void SendYardInit(const TActorContext &ctx, TDuration yardInitDelay) { auto ev = std::make_unique(Config->BaseInfo.InitOwnerRound, SelfVDiskId, @@ -596,8 +578,8 @@ namespace NKikimr { LOG_NOTICE(ctx, BS_LOCALRECOVERY, VDISKP(LocRecCtx->VCtx->VDiskLogPrefix, "LocalRecovery START")); - SendYardInit(ctx, Config->BaseInfo.YardInitDelay); - Become(&TThis::StateInitialize, ctx, VDiskCooldownTimeout, new TEvents::TEvWakeup); + SendYardInit(ctx, TDuration::Zero()); + Become(&TThis::StateInitialize); VDiskMonGroup.VDiskLocalRecoveryState() = TDbMon::TDbLocalRecovery::YardInit; } @@ -649,28 +631,24 @@ namespace NKikimr { HFunc(TEvents::TEvUndelivered, HandleUndelivered) CFunc(NActors::TEvents::TSystem::PoisonPill, HandlePoison) HFunc(NMon::TEvHttpInfo, Handle) - CFunc(TEvents::TSystem::Wakeup, HandleWakeup); ) STRICT_STFUNC(StateLoadDatabase, HFunc(THullIndexLoaded, Handle) CFunc(NActors::TEvents::TSystem::PoisonPill, HandlePoison) HFunc(NMon::TEvHttpInfo, Handle) - CFunc(TEvents::TSystem::Wakeup, HandleWakeup); ) STRICT_STFUNC(StateLoadBulkFormedSegments, HFunc(TEvBulkSstsLoaded, Handle) CFunc(NActors::TEvents::TSystem::PoisonPill, HandlePoison) HFunc(NMon::TEvHttpInfo, Handle) - CFunc(TEvents::TSystem::Wakeup, HandleWakeup); ) STRICT_STFUNC(StateApplyRecoveryLog, HFunc(TEvRecoveryLogReplayDone, Handle) CFunc(NActors::TEvents::TSystem::PoisonPill, HandlePoison) HFunc(NMon::TEvHttpInfo, Handle) - CFunc(TEvents::TSystem::Wakeup, HandleWakeup); ) public: @@ -693,11 +671,7 @@ namespace NKikimr { , LocRecCtx(std::make_shared(vctx)) , Arena(std::move(arena)) , VDiskMonGroup(vctx->VDiskCounters, "subsystem", "state") - { - if (!Config->EnableVDiskCooldownTimeout || LocRecCtx->VCtx->Top->GType.BlobSubgroupSize() == 1) { - CooldownTimerHit = true; - } - } + {} }; diff --git a/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer.cpp b/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer.cpp index d347e8b6e8c6..73505fea4862 100644 --- a/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer.cpp +++ b/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer.cpp @@ -298,10 +298,19 @@ namespace NKikimr { } Become(&TThis::RecoverLostDataStateFunc); + Phase = TPhaseVal::PhaseRecoverLostData; + + if (SyncerCtx->Config->EnableVDiskCooldownTimeout) { + Schedule(SyncerCtx->Config->BaseInfo.YardInitDelay, new TEvents::TEvWakeup); + } else { + RecoverLostDataResumeAfterDelay(ctx); + } + } + + void RecoverLostDataResumeAfterDelay(const TActorContext& ctx) { const TVDiskEternalGuid guid = GuidRecovOutcome->Guid; RecoverLostDataId = ctx.Register(CreateSyncerRecoverLostDataActor(SyncerCtx, GInfo, CommitterId, ctx.SelfID, guid)); ActiveActors.Insert(RecoverLostDataId, __FILE__, __LINE__, ctx, NKikimrServices::BLOBSTORAGE); - Phase = TPhaseVal::PhaseRecoverLostData; } void Handle(TEvSyncerLostDataRecovered::TPtr &ev, const TActorContext &ctx) { @@ -322,6 +331,7 @@ namespace NKikimr { HFunc(TEvents::TEvPoisonPill, HandlePoison) HFunc(TEvSublogLine, Handle) HFunc(TEvVGenerationChange, RecoverLostDataModeHandle) + CFunc(TEvents::TSystem::Wakeup, RecoverLostDataResumeAfterDelay); ) ////////////////////////////////////////////////////////////////////////