diff options
author | alexvru <[email protected]> | 2023-03-30 12:05:06 +0300 |
---|---|---|
committer | alexvru <[email protected]> | 2023-03-30 12:05:06 +0300 |
commit | c3ca50deeb76c32715042126e6db1357f347b7cc (patch) | |
tree | 5697f4ffd8dd49df286f0be470e905fc1c355156 | |
parent | 3de7ef56f40d8d7d5b6afbef0cae1732dc5784fe (diff) |
Fix BS_CONTROLLER forbidden disks generation
-rw-r--r-- | ydb/core/mind/bscontroller/config.cpp | 15 | ||||
-rw-r--r-- | ydb/core/mind/bscontroller/config.h | 3 | ||||
-rw-r--r-- | ydb/core/mind/bscontroller/config_fit_groups.cpp | 7 | ||||
-rw-r--r-- | ydb/core/mind/bscontroller/impl.h | 1 | ||||
-rw-r--r-- | ydb/core/mind/bscontroller/load_everything.cpp | 7 | ||||
-rw-r--r-- | ydb/core/mind/bscontroller/node_report.cpp | 2 |
6 files changed, 30 insertions, 5 deletions
diff --git a/ydb/core/mind/bscontroller/config.cpp b/ydb/core/mind/bscontroller/config.cpp index 4de6b1be403..b1c9f80b55d 100644 --- a/ydb/core/mind/bscontroller/config.cpp +++ b/ydb/core/mind/bscontroller/config.cpp @@ -337,7 +337,7 @@ namespace NKikimr::NBsController { } for (const auto& [vslotId, vslot] : std::exchange(pdiskInfo->VSlotsOnPDisk, {})) { Y_VERIFY(vslot->IsBeingDeleted()); - state.VSlots.DeleteExistingEntry(TVSlotId(pdiskId, vslotId)); + state.DeleteDestroyedVSlot(vslot); } state.PDisks.DeleteExistingEntry(pdiskId); } @@ -571,7 +571,7 @@ namespace NKikimr::NBsController { } } - void TBlobStorageController::TConfigState::DestroyVSlot(const TVSlotId vslotId, const TVSlotInfo *ensureAcceptorSlot) { + void TBlobStorageController::TConfigState::DestroyVSlot(TVSlotId vslotId, const TVSlotInfo *ensureAcceptorSlot) { // obtain mutable slot pointer TVSlotInfo *mutableSlot = VSlots.FindForUpdate(vslotId); Y_VERIFY(mutableSlot); @@ -621,12 +621,21 @@ namespace NKikimr::NBsController { Y_VERIFY(erased); VSlots.DeleteExistingEntry(vslotId); // this slot hasn't been created yet and can be deleted safely } else { - const TGroupInfo *group = Groups.Find(mutableSlot->GroupId); + TGroupInfo *group = Groups.FindForUpdate(mutableSlot->GroupId); Y_VERIFY(group); + group->VSlotsBeingDeleted.insert(vslotId); mutableSlot->ScheduleForDeletion(group->StoragePoolId); } } + void TBlobStorageController::TConfigState::DeleteDestroyedVSlot(const TVSlotInfo *vslot) { + if (TGroupInfo *group = Groups.FindForUpdate(vslot->GroupId)) { + const size_t num = group->VSlotsBeingDeleted.erase(vslot->VSlotId); + Y_VERIFY(num); + } + VSlots.DeleteExistingEntry(vslot->VSlotId); + } + void TBlobStorageController::TConfigState::CheckConsistency() const { #ifndef NDEBUG PDisks.ForEach([&](const auto& pdiskId, const auto& pdisk) { diff --git a/ydb/core/mind/bscontroller/config.h b/ydb/core/mind/bscontroller/config.h index 8ffe76abf0e..022c0ffcd39 100644 --- a/ydb/core/mind/bscontroller/config.h +++ b/ydb/core/mind/bscontroller/config.h @@ -205,7 +205,8 @@ namespace NKikimr { return res; } - void DestroyVSlot(const TVSlotId vslotId, const TVSlotInfo *ensureAcceptorSlot = nullptr); + void DestroyVSlot(TVSlotId vslotId, const TVSlotInfo *ensureAcceptorSlot = nullptr); + void DeleteDestroyedVSlot(const TVSlotInfo *vslot); void CheckConsistency() const; diff --git a/ydb/core/mind/bscontroller/config_fit_groups.cpp b/ydb/core/mind/bscontroller/config_fit_groups.cpp index a5ec4df6bb7..741c1e5f369 100644 --- a/ydb/core/mind/bscontroller/config_fit_groups.cpp +++ b/ydb/core/mind/bscontroller/config_fit_groups.cpp @@ -252,6 +252,13 @@ namespace NKikimr { } } } + for (const auto& vslotId : groupInfo->VSlotsBeingDeleted) { + const TVSlotInfo *vslot = State.VSlots.Find(vslotId); + const TVDiskIdShort& vdiskId = vslot->GetShortVDiskId(); + if (group[vdiskId.FailRealm][vdiskId.FailDomain][vdiskId.VDisk] == TPDiskId()) { + forbid.insert(vslotId.ComprisingPDiskId()); + } + } if ((replacedSlots.empty() && sanitizingRequest) || (State.Self.IsGroupLayoutSanitizerEnabled() && replacedSlots.size() == 1 && hasMissingSlots)) { auto result = SanitizeGroup(groupId, group, std::move(forbid), requiredSpace, AllowUnusableDisks); diff --git a/ydb/core/mind/bscontroller/impl.h b/ydb/core/mind/bscontroller/impl.h index cd9d5b7ce6c..f895615a27a 100644 --- a/ydb/core/mind/bscontroller/impl.h +++ b/ydb/core/mind/bscontroller/impl.h @@ -514,6 +514,7 @@ public: bool Down = false; // is group are down right now (not selectable) TVector<TIndirectReferable<TVSlotInfo>::TPtr> VDisksInGroup; + THashSet<TVSlotId> VSlotsBeingDeleted; TGroupLatencyStats LatencyStats; TBoxStoragePoolId StoragePoolId; mutable TStorageStatusFlags StatusFlags; diff --git a/ydb/core/mind/bscontroller/load_everything.cpp b/ydb/core/mind/bscontroller/load_everything.cpp index 3cbe0b3cd68..5bcbb01d4a9 100644 --- a/ydb/core/mind/bscontroller/load_everything.cpp +++ b/ydb/core/mind/bscontroller/load_everything.cpp @@ -375,6 +375,13 @@ public: for (const auto& [id, group] : Self->GroupMap) { group->FinishVDisksInGroup(); } + for (const auto& [vslotId, vslot] : Self->VSlots) { + if (vslot->IsBeingDeleted()) { + if (TGroupInfo *group = Self->FindGroup(vslot->GroupId)) { + group->VSlotsBeingDeleted.insert(vslotId); + } + } + } // tie donors and acceptors for (const auto& [vslotId, vslot] : Self->VSlots) { diff --git a/ydb/core/mind/bscontroller/node_report.cpp b/ydb/core/mind/bscontroller/node_report.cpp index 083f8b55df5..4e25f41be62 100644 --- a/ydb/core/mind/bscontroller/node_report.cpp +++ b/ydb/core/mind/bscontroller/node_report.cpp @@ -55,7 +55,7 @@ public: if (slot->IsBeingDeleted()) { const size_t num = const_cast<TPDiskInfo&>(*slot->PDisk).VSlotsOnPDisk.erase(slot->VSlotId.VSlotId); Y_VERIFY(num); - State->VSlots.DeleteExistingEntry(slot->VSlotId); + State->DeleteDestroyedVSlot(slot); } break; |