Skip to content

Commit

Permalink
Fix delayed synchronization bug (ydb-platform#5550)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexvru authored Jun 14, 2024
1 parent 45f5022 commit 1be6e57
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 19 deletions.
2 changes: 1 addition & 1 deletion ydb/core/blobstorage/nodewarden/node_warden_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ void TNodeWarden::Handle(NPDisk::TEvSlayResult::TPtr ev) {
} else {
SendVDiskReport(vslotId, msg.VDiskId, NKikimrBlobStorage::TEvControllerNodeReport::WIPED);
TVDiskRecord& vdisk = vdiskIt->second;
StartLocalVDiskActor(vdisk, TDuration::Zero()); // restart actor after successful wiping
StartLocalVDiskActor(vdisk); // restart actor after successful wiping
SendDiskMetrics(false);
}
break;
Expand Down
3 changes: 1 addition & 2 deletions ydb/core/blobstorage/nodewarden/node_warden_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,6 @@ namespace NKikimr::NStorage {
std::optional<TRuntimeData> RuntimeData;
bool ShutdownPending = false;
bool RestartAfterShutdown = false;
TDuration YardInitDelay;

// Last VDiskId reported to Node Whiteboard.
std::optional<TVDiskID> WhiteboardVDiskId;
Expand Down Expand Up @@ -396,7 +395,7 @@ namespace NKikimr::NStorage {

void DestroyLocalVDisk(TVDiskRecord& vdisk);
void PoisonLocalVDisk(TVDiskRecord& vdisk);
void StartLocalVDiskActor(TVDiskRecord& vdisk, TDuration yardInitDelay);
void StartLocalVDiskActor(TVDiskRecord& vdisk);
void HandleGone(STATEFN_SIG);
void ApplyServiceSetVDisks(const NKikimrBlobStorage::TNodeWardenServiceSet& serviceSet);

Expand Down
4 changes: 2 additions & 2 deletions ydb/core/blobstorage/nodewarden/node_warden_pdisk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ namespace NKikimr::NStorage {
key.PDiskId, key.VDiskSlotId));
it->second = round;
} else {
StartLocalVDiskActor(value, TDuration::Zero());
StartLocalVDiskActor(value);
}
}
SendDiskMetrics(false);
Expand All @@ -263,7 +263,7 @@ namespace NKikimr::NStorage {
for (auto it = LocalVDisks.lower_bound(from); it != LocalVDisks.end() && it->first <= to; ++it) {
auto& [key, value] = *it;
if (!value.RuntimeData && !SlayInFlight.contains(key)) {
StartLocalVDiskActor(value, TDuration::Zero());
StartLocalVDiskActor(value);
}
}
}
Expand Down
17 changes: 7 additions & 10 deletions ydb/core/blobstorage/nodewarden/node_warden_vdisk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace NKikimr::NStorage {
SendDiskMetrics(false);
}

void TNodeWarden::StartLocalVDiskActor(TVDiskRecord& vdisk, TDuration yardInitDelay) {
void TNodeWarden::StartLocalVDiskActor(TVDiskRecord& vdisk) {
const TVSlotId vslotId = vdisk.GetVSlotId();
const ui64 pdiskGuid = vdisk.Config.GetVDiskLocation().GetPDiskGuid();
const bool donorMode = vdisk.Config.HasDonorMode();
Expand All @@ -73,7 +73,6 @@ namespace NKikimr::NStorage {

if (vdisk.ShutdownPending) {
vdisk.RestartAfterShutdown = true;
vdisk.YardInitDelay = Max(vdisk.YardInitDelay, yardInitDelay);
return;
}

Expand Down Expand Up @@ -175,7 +174,7 @@ namespace NKikimr::NStorage {
baseInfo.ReplPDiskWriteQuoter = pdiskIt->second.ReplPDiskWriteQuoter;
baseInfo.ReplNodeRequestQuoter = ReplNodeRequestQuoter;
baseInfo.ReplNodeResponseQuoter = ReplNodeResponseQuoter;
baseInfo.YardInitDelay = yardInitDelay;
baseInfo.YardInitDelay = VDiskCooldownTimeout;

TIntrusivePtr<TVDiskConfig> vdiskConfig = Cfg->AllVDiskKinds->MakeVDiskConfig(baseInfo);
vdiskConfig->EnableVDiskCooldownTimeout = Cfg->EnableVDiskCooldownTimeout;
Expand Down Expand Up @@ -248,10 +247,8 @@ namespace NKikimr::NStorage {
TVDiskRecord& vdisk = jt->second;
Y_ABORT_UNLESS(vdisk.ShutdownPending);
vdisk.ShutdownPending = false;
if (vdisk.RestartAfterShutdown) {
StartLocalVDiskActor(vdisk, vdisk.YardInitDelay);
vdisk.RestartAfterShutdown = false;
vdisk.YardInitDelay = TDuration::Zero();
if (std::exchange(vdisk.RestartAfterShutdown, false)) {
StartLocalVDiskActor(vdisk);
}
}
VDiskIdByActor.erase(it);
Expand Down Expand Up @@ -315,10 +312,10 @@ namespace NKikimr::NStorage {
} else if (vdisk.GetDoWipe()) {
Slay(record);
} else if (!record.RuntimeData) {
StartLocalVDiskActor(record, TDuration::Zero());
StartLocalVDiskActor(record);
} else if (record.RuntimeData->DonorMode < record.Config.HasDonorMode() || record.RuntimeData->ReadOnly != record.Config.GetReadOnly()) {
PoisonLocalVDisk(record);
StartLocalVDiskActor(record, VDiskCooldownTimeout);
StartLocalVDiskActor(record);
}
}

Expand All @@ -345,7 +342,7 @@ namespace NKikimr::NStorage {
auto& record = it->second;
if (record.GetVDiskId() == vDiskId) {
PoisonLocalVDisk(record);
StartLocalVDiskActor(record, VDiskCooldownTimeout);
StartLocalVDiskActor(record);
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ namespace NKikimr {
BarriersEssence = BarriersSnap.CreateEssence(HullCtx);
}

bool Check(const TKeyLogoBlob &key,
const TMemRecLogoBlob &memRec,
bool allowKeepFlags) const {
return BarriersEssence->Keep(key, memRec, {}, allowKeepFlags, false /*allowGarbageCollection*/).KeepData;
bool Check(const TKeyLogoBlob &key, const TMemRecLogoBlob &memRec, bool allowKeepFlags) const {
return BarriersEssence->Keep(key, memRec, {}, allowKeepFlags, true).KeepData;
}

TIntrusivePtr<THullCtx> HullCtx;
Expand Down

0 comments on commit 1be6e57

Please sign in to comment.