diff options
author | Alexander Rutkovsky <alexvru@mail.ru> | 2022-03-03 21:05:13 +0300 |
---|---|---|
committer | Alexander Rutkovsky <alexvru@mail.ru> | 2022-03-03 21:05:13 +0300 |
commit | d78b6874885839028e196a3e1a9d279b838675f6 (patch) | |
tree | d7f9afb77119ac96b3ad0fab0c60619353c7f3df | |
parent | 4752794f1aa4beb257a0604a6caa02185a2a8840 (diff) | |
download | ydb-d78b6874885839028e196a3e1a9d279b838675f6.tar.gz |
Enhance group resolver logic KIKIMR-13568
ref:d6e11cc1314883f74ae596c6c32e62bc5e9932b7
-rw-r--r-- | ydb/core/blobstorage/nodewarden/node_warden_group_resolver.cpp | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/ydb/core/blobstorage/nodewarden/node_warden_group_resolver.cpp b/ydb/core/blobstorage/nodewarden/node_warden_group_resolver.cpp index 75c6eb26be..c86b742e24 100644 --- a/ydb/core/blobstorage/nodewarden/node_warden_group_resolver.cpp +++ b/ydb/core/blobstorage/nodewarden/node_warden_group_resolver.cpp @@ -165,6 +165,7 @@ namespace NKikimr::NStorage { needed.erase(it->second); } if (needed.empty()) { + Y_VERIFY_DEBUG(GetResultingGroupInfo()); return false; // information we have is quite conclusive, nothing more to scan } } @@ -183,9 +184,6 @@ namespace NKikimr::NStorage { const auto& record = ev->Get()->Record; STLOG(PRI_DEBUG, BS_NODE, NW84, "TGroupResolverActor::TEvNodeWardenGroupInfo", (GroupId, GroupId), (NodeId, nodeId), (Msg, ev->Get()->ToString())); - if (record.HasGroup()) { // remember group info - GroupInfoReceived.emplace(nodeId, record.GetGroup()); - } // remove group<->node mapping for selected node and clear started groups vector auto& nodeInfo = Ctx.NodeInfo[nodeId]; @@ -198,9 +196,15 @@ namespace NKikimr::NStorage { // fill in new started groups vector and create appropriate map const auto& startedGroupIds = record.GetStartedGroupIds(); nodeInfo.StartedGroupIds.insert(nodeInfo.StartedGroupIds.end(), startedGroupIds.begin(), startedGroupIds.end()); + bool trustworthy = false; for (ui32 groupId : nodeInfo.StartedGroupIds) { const bool inserted = Ctx.StartedGroupIdToNodes.emplace(groupId, nodeId).second; Y_VERIFY(inserted); + trustworthy |= groupId == GroupId; // the group we are looking for + } + + if (trustworthy && record.HasGroup()) { // remember group info + GroupInfoReceived.emplace(nodeId, record.GetGroup()); } QueriesInFlight.erase(nodeId); @@ -232,6 +236,19 @@ namespace NKikimr::NStorage { result = &group; } } + if (result) { + TIntrusivePtr<TBlobStorageGroupInfo> info = TBlobStorageGroupInfo::Parse(*result, nullptr, nullptr); + TBlobStorageGroupInfo::TGroupVDisks received(&info->GetTopology()); + for (ui32 i = 0; i < info->GetTotalVDisksNum(); ++i) { + const TActorId& actorId = info->GetActorId(i); + if (GroupInfoReceived.count(actorId.NodeId())) { + received |= {&info->GetTopology(), info->GetVDiskId(i)}; + } + } + if (!info->GetQuorumChecker().CheckQuorumForGroup(received)) { + result = nullptr; + } + } return result; } @@ -317,8 +334,10 @@ namespace NKikimr::NStorage { if (const auto it = Groups.find(r.GetGroupId()); it != Groups.end() && it->second.Group) { record.MutableGroup()->CopyFrom(*it->second.Group); } - for (const auto& [groupId, group] : Groups) { - record.AddStartedGroupIds(groupId); + for (const auto& [key, value] : LocalVDisks) { + if (const auto& r = value.RuntimeData; r && !r->DonorMode) { + record.AddStartedGroupIds(r->GroupInfo->GroupID); + } } Send(ev->Sender, res.release(), 0, ev->Cookie); } |