aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorserg-belyakov <serg-belyakov@yandex-team.com>2023-04-12 12:34:51 +0300
committerserg-belyakov <serg-belyakov@yandex-team.com>2023-04-12 12:34:51 +0300
commita19d3fb8952bd93624ebea58ac0df578e638853b (patch)
tree64a1b20fc1acd24be1ba42384f90906f5062e4b2
parentd4a79b34585ee4e26f1de7a9b9614ac2012a28c6 (diff)
downloadydb-a19d3fb8952bd93624ebea58ac0df578e638853b.tar.gz
Improve GroupLayoutSanitizer checks,
Add GLSPeriodicity parameter, refactor long variable names
-rw-r--r--ydb/core/mind/bscontroller/cmds_storage_pool.cpp2
-rw-r--r--ydb/core/mind/bscontroller/config_cmd.cpp6
-rw-r--r--ydb/core/mind/bscontroller/impl.h6
-rw-r--r--ydb/core/mind/bscontroller/load_everything.cpp2
-rw-r--r--ydb/core/mind/bscontroller/self_heal.cpp57
-rw-r--r--ydb/core/mind/bscontroller/self_heal.h2
6 files changed, 31 insertions, 44 deletions
diff --git a/ydb/core/mind/bscontroller/cmds_storage_pool.cpp b/ydb/core/mind/bscontroller/cmds_storage_pool.cpp
index 0945e58a258..30e181a19d5 100644
--- a/ydb/core/mind/bscontroller/cmds_storage_pool.cpp
+++ b/ydb/core/mind/bscontroller/cmds_storage_pool.cpp
@@ -443,7 +443,7 @@ namespace NKikimr::NBsController {
settings->AddGroupReservePartPPM(Self.GroupReservePart);
settings->AddMaxScrubbedDisksAtOnce(Self.MaxScrubbedDisksAtOnce);
settings->AddPDiskSpaceColorBorder(Self.PDiskSpaceColorBorder);
- settings->AddEnableGroupLayoutSanitizer(Self.GroupLayoutSanitizer);
+ settings->AddEnableGroupLayoutSanitizer(Self.GroupLayoutSanitizerEnabled);
// TODO:
// settings->AddSerialManagementStage(Self.SerialManagementStage);
}
diff --git a/ydb/core/mind/bscontroller/config_cmd.cpp b/ydb/core/mind/bscontroller/config_cmd.cpp
index b6221181189..050468f9cea 100644
--- a/ydb/core/mind/bscontroller/config_cmd.cpp
+++ b/ydb/core/mind/bscontroller/config_cmd.cpp
@@ -127,10 +127,10 @@ namespace NKikimr::NBsController {
db.Table<T>().Key(true).Update<T::PDiskSpaceColorBorder>(Self->PDiskSpaceColorBorder);
}
for (bool value : settings.GetEnableGroupLayoutSanitizer()) {
- Self->GroupLayoutSanitizer = value;
- db.Table<T>().Key(true).Update<T::GroupLayoutSanitizer>(Self->GroupLayoutSanitizer);
+ Self->GroupLayoutSanitizerEnabled = value;
+ db.Table<T>().Key(true).Update<T::GroupLayoutSanitizer>(Self->GroupLayoutSanitizerEnabled);
auto ev = std::make_unique<TEvControllerUpdateSelfHealInfo>();
- ev->GroupLayoutSanitizer = Self->GroupLayoutSanitizer;
+ ev->GroupLayoutSanitizerEnabled = Self->GroupLayoutSanitizerEnabled;
Self->Send(Self->SelfHealId, ev.release());
}
return true;
diff --git a/ydb/core/mind/bscontroller/impl.h b/ydb/core/mind/bscontroller/impl.h
index b0b40240eaf..805f8e3540e 100644
--- a/ydb/core/mind/bscontroller/impl.h
+++ b/ydb/core/mind/bscontroller/impl.h
@@ -1449,8 +1449,10 @@ private:
THashMap<TPDiskId, ui32> StaticPDiskSlotUsage;
std::unique_ptr<TStoragePoolStat> StoragePoolStat;
bool StopGivingGroups = false;
- bool GroupLayoutSanitizer = false;
+ bool GroupLayoutSanitizerEnabled = false;
+
std::set<std::tuple<TGroupId, TNodeId>> GroupToNode;
+
NKikimrBlobStorage::TSerialManagementStage::E SerialManagementStage
= NKikimrBlobStorage::TSerialManagementStage::DISCOVER_SERIAL;
@@ -1717,7 +1719,7 @@ public:
IActor *CreateSelfHealActor();
bool IsGroupLayoutSanitizerEnabled() const {
- return GroupLayoutSanitizer;
+ return GroupLayoutSanitizerEnabled;
}
// For test purposes, required for self heal actor
diff --git a/ydb/core/mind/bscontroller/load_everything.cpp b/ydb/core/mind/bscontroller/load_everything.cpp
index d1a90a80c88..98460d07bf7 100644
--- a/ydb/core/mind/bscontroller/load_everything.cpp
+++ b/ydb/core/mind/bscontroller/load_everything.cpp
@@ -84,7 +84,7 @@ public:
Self->GroupReservePart = state.GetValue<T::GroupReservePart>();
Self->MaxScrubbedDisksAtOnce = state.GetValue<T::MaxScrubbedDisksAtOnce>();
Self->PDiskSpaceColorBorder = state.GetValue<T::PDiskSpaceColorBorder>();
- Self->GroupLayoutSanitizer = state.GetValue<T::GroupLayoutSanitizer>();
+ Self->GroupLayoutSanitizerEnabled = state.GetValue<T::GroupLayoutSanitizer>();
Self->SysViewChangedSettings = true;
}
}
diff --git a/ydb/core/mind/bscontroller/self_heal.cpp b/ydb/core/mind/bscontroller/self_heal.cpp
index c5bf347b290..4f657e28598 100644
--- a/ydb/core/mind/bscontroller/self_heal.cpp
+++ b/ydb/core/mind/bscontroller/self_heal.cpp
@@ -251,16 +251,10 @@ namespace NKikimr::NBsController {
TIntrusiveList<TGroupRecord, TWithFaultyDisks> GroupsWithFaultyDisks;
TIntrusiveList<TGroupRecord, TWithInvalidLayout> GroupsWithInvalidLayout;
std::shared_ptr<std::atomic_uint64_t> UnreassignableGroups;
- bool GroupLayoutSanitizer = false;
+ bool GroupLayoutSanitizerEnabled = false;
THostRecordMap HostRecords;
- enum EPeriodicProcess {
- SELF_HEAL = 0,
- GROUP_LAYOUT_SANITIZER,
- };
-
static constexpr TDuration SelfHealWakeupPeriod = TDuration::Seconds(10);
- static constexpr TDuration GroupLayoutSanitizerWakeupPeriod = TDuration::Seconds(60);
public:
TSelfHealActor(ui64 tabletId, std::shared_ptr<std::atomic_uint64_t> unreassignableGroups, THostRecordMap hostRecords)
@@ -272,14 +266,16 @@ namespace NKikimr::NBsController {
void Bootstrap(const TActorId& parentId) {
ControllerId = parentId;
Become(&TThis::StateFunc);
- HandleWakeup(EPeriodicProcess::SELF_HEAL);
- HandleWakeup(EPeriodicProcess::GROUP_LAYOUT_SANITIZER);
+ HandleWakeup();
}
void Handle(TEvControllerUpdateSelfHealInfo::TPtr& ev) {
const TInstant now = TActivationContext::Now();
- if (const auto& setting = ev->Get()->GroupLayoutSanitizer) {
- GroupLayoutSanitizer = *setting;
+ if (const auto& setting = ev->Get()->GroupLayoutSanitizerEnabled) {
+ bool previousSetting = std::exchange(GroupLayoutSanitizerEnabled, *setting);
+ if (!previousSetting && GroupLayoutSanitizerEnabled) {
+ UpdateLayoutInformationForAllGroups();
+ }
}
for (const auto& [groupId, data] : ev->Get()->GroupsToUpdate) {
if (data) {
@@ -289,7 +285,7 @@ namespace NKikimr::NBsController {
g.Content = std::move(*data);
- if (GroupLayoutSanitizer) {
+ if (GroupLayoutSanitizerEnabled) {
UpdateGroupLayoutInformation(g);
}
@@ -357,7 +353,7 @@ namespace NKikimr::NBsController {
}
}
- if (GroupLayoutSanitizer) {
+ if (GroupLayoutSanitizerEnabled) {
for (auto it = GroupsWithInvalidLayout.begin(); it != GroupsWithInvalidLayout.end(); ) {
TGroupRecord& group = *it++;
Y_VERIFY(!group.LayoutValid);
@@ -409,6 +405,12 @@ namespace NKikimr::NBsController {
group.LayoutValid = isValid;
}
+ void UpdateLayoutInformationForAllGroups() {
+ for (auto& [_, group] : Groups) {
+ UpdateGroupLayoutInformation(group);
+ }
+ }
+
std::optional<TVDiskID> FindVDiskToReplace(const THashMap<TVDiskID, TVDiskStatusTracker>& tracker,
const TEvControllerUpdateSelfHealInfo::TGroupContent& content, TInstant now) {
auto status = [&](const TVDiskID& id) {
@@ -472,26 +474,9 @@ namespace NKikimr::NBsController {
return std::move(groupDefinition);
}
- void HandleWakeup(EPeriodicProcess process) {
- switch (process) {
- case EPeriodicProcess::SELF_HEAL:
- CheckGroups();
- Schedule(SelfHealWakeupPeriod, new TEvents::TEvWakeup(EPeriodicProcess::SELF_HEAL));
- break;
-
- case EPeriodicProcess::GROUP_LAYOUT_SANITIZER:
- if (GroupLayoutSanitizer) {
- for (auto& [_, group] : Groups) {
- UpdateGroupLayoutInformation(group);
- }
- }
- Schedule(GroupLayoutSanitizerWakeupPeriod, new TEvents::TEvWakeup(EPeriodicProcess::GROUP_LAYOUT_SANITIZER));
- break;
- }
- }
-
- void Handle(TEvents::TEvWakeup::TPtr& ev) {
- HandleWakeup(EPeriodicProcess(ev->Get()->Tag));
+ void HandleWakeup() {
+ CheckGroups();
+ Schedule(SelfHealWakeupPeriod, new TEvents::TEvWakeup());
}
void Handle(NMon::TEvRemoteHttpInfo::TPtr& ev) {
@@ -634,7 +619,7 @@ namespace NKikimr::NBsController {
out << "Group Layout Sanitizer";
}
DIV_CLASS("panel-body") {
- out << "Status: " << (GroupLayoutSanitizer ? "enabled" : "disabled");
+ out << "Status: " << (GroupLayoutSanitizerEnabled ? "enabled" : "disabled");
}
}
@@ -723,7 +708,7 @@ namespace NKikimr::NBsController {
hFunc(TEvControllerUpdateSelfHealInfo, Handle);
hFunc(NMon::TEvRemoteHttpInfo, Handle);
hFunc(TEvReassignerDone, Handle);
- hFunc(TEvents::TEvWakeup, Handle);
+ cFunc(TEvents::TSystem::Wakeup, HandleWakeup);
hFunc(TEvPrivate::TEvUpdateHostRecords, Handle);
})
};
@@ -739,7 +724,7 @@ namespace NKikimr::NBsController {
ev->GroupsToUpdate.emplace(groupId, TEvControllerUpdateSelfHealInfo::TGroupContent());
}
FillInSelfHealGroups(*ev, nullptr);
- ev->GroupLayoutSanitizer = GroupLayoutSanitizer;
+ ev->GroupLayoutSanitizerEnabled = GroupLayoutSanitizerEnabled;
Send(SelfHealId, ev.Release());
}
diff --git a/ydb/core/mind/bscontroller/self_heal.h b/ydb/core/mind/bscontroller/self_heal.h
index b2740f4800b..38d9c0657ef 100644
--- a/ydb/core/mind/bscontroller/self_heal.h
+++ b/ydb/core/mind/bscontroller/self_heal.h
@@ -25,7 +25,7 @@ namespace NKikimr::NBsController {
THashMap<TGroupId, std::optional<TGroupContent>> GroupsToUpdate; // groups with faulty groups that are changed or got faulty PDisks for the first time
TVector<std::pair<TVDiskID, NKikimrBlobStorage::EVDiskStatus>> VDiskStatusUpdate;
- std::optional<bool> GroupLayoutSanitizer;
+ std::optional<bool> GroupLayoutSanitizerEnabled;
};
} // NKikimr::NBsController