summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralexvru <[email protected]>2023-03-30 18:58:49 +0300
committeralexvru <[email protected]>2023-03-30 18:58:49 +0300
commit9713bbb42cbc69d5394597c510b50b0f1c5ae9f2 (patch)
tree2b01450c1cfe2be2b72ec04826891eaa8411608d
parentcd511a699127414af44613a6def4875fc3ce701a (diff)
Propagate full group configuration on configuration change
-rw-r--r--ydb/core/mind/bscontroller/config.cpp24
-rw-r--r--ydb/core/mind/bscontroller/get_group.cpp6
-rw-r--r--ydb/core/mind/bscontroller/impl.h2
-rw-r--r--ydb/core/mind/bscontroller/register_node.cpp8
4 files changed, 34 insertions, 6 deletions
diff --git a/ydb/core/mind/bscontroller/config.cpp b/ydb/core/mind/bscontroller/config.cpp
index b1c9f80b55d..0b399fdc60f 100644
--- a/ydb/core/mind/bscontroller/config.cpp
+++ b/ydb/core/mind/bscontroller/config.cpp
@@ -197,7 +197,7 @@ namespace NKikimr::NBsController {
// GROUP OPERATIONS
////////////////////////////////////////////////////////////////////////////////////////////////////////////
- void ApplyGroupCreated(const TGroupId& /*groupId*/, const TGroupInfo &groupInfo) {
+ void ApplyGroupCreated(const TGroupId& groupId, const TGroupInfo &groupInfo) {
if (!groupInfo.VDisksInGroup && groupInfo.VirtualGroupState != NKikimrBlobStorage::EVirtualGroupState::WORKING) {
return; // do not report virtual groups that are not properly created yet
}
@@ -208,6 +208,11 @@ namespace NKikimr::NBsController {
Y_VERIFY(vslot->GroupGeneration == groupInfo.Generation);
nodes.insert(vslot->VSlotId.NodeId);
}
+ for (auto it = Self->GroupToNode.lower_bound(std::make_tuple(groupId, Min<TNodeId>()));
+ it != Self->GroupToNode.end() && *it <= std::make_tuple(groupId, Max<TNodeId>()); ++it) {
+ const auto [groupId, nodeId] = *it;
+ nodes.insert(nodeId);
+ }
// check tenant id, if necessary
TMaybe<TKikimrScopeId> scopeId;
@@ -239,11 +244,6 @@ namespace NKikimr::NBsController {
void ApplyGroupDiff(const TGroupId &groupId, const TGroupInfo &prev, const TGroupInfo &cur) {
if (prev.Generation != cur.Generation) {
ApplyGroupCreated(groupId, cur);
- for (const auto& [key, info] : *State.HostRecords) {
- auto *meta = Services[info.NodeId].AddGroupMetadata();
- meta->SetGroupId(groupId);
- meta->SetCurrentGeneration(cur.Generation);
- }
}
Y_VERIFY(prev.VDisksInGroup.size() == cur.VDisksInGroup.size() ||
(cur.VDisksInGroup.empty() && cur.DecommitStatus == NKikimrBlobStorage::TGroupDecommitStatus::DONE));
@@ -421,6 +421,18 @@ namespace NKikimr::NBsController {
}
}
+ for (auto&& [base, overlay] : state.Groups.Diff()) {
+ if (!overlay->second) { // deleted group
+ auto begin = GroupToNode.lower_bound(std::make_tuple(overlay->first, Min<TNodeId>()));
+ auto end = GroupToNode.upper_bound(std::make_tuple(overlay->first, Max<TNodeId>()));
+ for (auto it = begin; it != end; ++it) {
+ const auto [groupId, nodeId] = *it;
+ GetNode(nodeId).GroupsRequested.erase(groupId);
+ }
+ GroupToNode.erase(begin, end);
+ }
+ }
+
TNodeWardenUpdateNotifier(this, state).Execute(state.Outbox);
state.CheckConsistency();
diff --git a/ydb/core/mind/bscontroller/get_group.cpp b/ydb/core/mind/bscontroller/get_group.cpp
index 78b5d28bcaa..63d1ce140b6 100644
--- a/ydb/core/mind/bscontroller/get_group.cpp
+++ b/ydb/core/mind/bscontroller/get_group.cpp
@@ -27,6 +27,12 @@ public:
auto res = std::make_unique<TEvBlobStorage::TEvControllerNodeServiceSetUpdate>(NKikimrProto::OK, nodeId);
Self->ReadGroups(groupIDsToRead, true, res.get(), nodeId);
+ auto& node = Self->GetNode(nodeId);
+ for (TGroupId groupId : v) {
+ node.GroupsRequested.insert(groupId);
+ Self->GroupToNode.emplace(groupId, nodeId);
+ }
+
Response = std::make_unique<IEventHandle>(nodeId ? MakeBlobStorageNodeWardenID(nodeId) : Request->Sender,
Self->SelfId(), res.release());
diff --git a/ydb/core/mind/bscontroller/impl.h b/ydb/core/mind/bscontroller/impl.h
index f895615a27a..4258a24ce5f 100644
--- a/ydb/core/mind/bscontroller/impl.h
+++ b/ydb/core/mind/bscontroller/impl.h
@@ -827,6 +827,7 @@ public:
// in-mem only
std::map<TString, NPDisk::TDriveData> KnownDrives;
THashSet<TGroupId> WaitingForGroups;
+ THashSet<TGroupId> GroupsRequested;
template<typename T>
static void Apply(TBlobStorageController* /*controller*/, T&& callback) {
@@ -1428,6 +1429,7 @@ private:
std::unique_ptr<TStoragePoolStat> StoragePoolStat;
bool StopGivingGroups = false;
bool GroupLayoutSanitizer = false;
+ std::set<std::tuple<TGroupId, TNodeId>> GroupToNode;
NKikimrBlobStorage::TSerialManagementStage::E SerialManagementStage
= NKikimrBlobStorage::TSerialManagementStage::DISCOVER_SERIAL;
diff --git a/ydb/core/mind/bscontroller/register_node.cpp b/ydb/core/mind/bscontroller/register_node.cpp
index ff1ab7f99c3..3b7662094e7 100644
--- a/ydb/core/mind/bscontroller/register_node.cpp
+++ b/ydb/core/mind/bscontroller/register_node.cpp
@@ -314,6 +314,11 @@ public:
auto& node = Self->GetNode(nodeId);
db.Table<Schema::Node>().Key(nodeId).Update<Schema::Node::LastConnectTimestamp>(node.LastConnectTimestamp);
+ for (ui32 groupId : record.GetGroups()) {
+ node.GroupsRequested.insert(groupId);
+ Self->GroupToNode.emplace(groupId, nodeId);
+ }
+
return true;
}
@@ -533,6 +538,9 @@ void TBlobStorageController::OnWardenDisconnected(TNodeId nodeId) {
if (!lastSeenReadyQ.empty()) {
Execute(CreateTxUpdateLastSeenReady(std::move(lastSeenReadyQ)));
}
+ for (TGroupId groupId : std::exchange(node.GroupsRequested, {})) {
+ GroupToNode.erase(std::make_tuple(groupId, nodeId));
+ }
node.LastDisconnectTimestamp = now;
Execute(new TTxUpdateNodeDisconnectTimestamp(nodeId, this));
}