Skip to content

Commit

Permalink
fix hive sensors on node count (#5729)
Browse files Browse the repository at this point in the history
  • Loading branch information
vporyadke authored Jun 20, 2024
1 parent a355838 commit 6466c7e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 6 additions & 3 deletions ydb/core/mind/hive/hive_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -695,8 +695,8 @@ void THive::Handle(TEvLocal::TEvSyncTablets::TPtr& ev) {

void THive::Handle(TEvPrivate::TEvProcessDisconnectNode::TPtr& ev) {
TAutoPtr<TEvPrivate::TEvProcessDisconnectNode> event = ev->Release();
TNodeInfo& node = GetNode(event->NodeId);
if (node.IsDisconnecting()) {
TNodeInfo* node = FindNode(event->NodeId);
if (!node || node->IsDisconnecting()) {
auto itCategory = event->Tablets.begin();
if (itCategory != event->Tablets.end()) {
BLOG_D("THive::Handle::TEvProcessDisconnectNode: Node " << event->NodeId << " Category " << itCategory->first);
Expand Down Expand Up @@ -733,6 +733,7 @@ void THive::Handle(TEvInterconnect::TEvNodeConnected::TPtr &ev) {
TNodeId nodeId = ev->Get()->NodeId;
if (ConnectedNodes.insert(nodeId).second) {
BLOG_W("Handle TEvInterconnect::TEvNodeConnected, NodeId " << nodeId << " Cookie " << ev->Cookie);
UpdateCounterNodesConnected(+1);
Send(GetNameserviceActorId(), new TEvInterconnect::TEvGetNode(nodeId));
} else {
BLOG_TRACE("Handle TEvInterconnect::TEvNodeConnected (duplicate), NodeId " << nodeId << " Cookie " << ev->Cookie);
Expand All @@ -742,7 +743,9 @@ void THive::Handle(TEvInterconnect::TEvNodeConnected::TPtr &ev) {
void THive::Handle(TEvInterconnect::TEvNodeDisconnected::TPtr &ev) {
TNodeId nodeId = ev->Get()->NodeId;
BLOG_W("Handle TEvInterconnect::TEvNodeDisconnected, NodeId " << nodeId);
ConnectedNodes.erase(nodeId);
if (ConnectedNodes.erase(nodeId)) {
UpdateCounterNodesConnected(-1);
}
Execute(CreateDisconnectNode(THolder<TEvInterconnect::TEvNodeDisconnected>(ev->Release().Release())));
}

Expand Down
2 changes: 0 additions & 2 deletions ydb/core/mind/hive/node_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ void TNodeInfo::ChangeVolatileState(EVolatileState state) {
case EVolatileState::Disconnected:
case EVolatileState::Connecting:
RegisterInDomains();
Hive.UpdateCounterNodesConnected(+1);
break;

default:
Expand All @@ -43,7 +42,6 @@ void TNodeInfo::ChangeVolatileState(EVolatileState state) {
case EVolatileState::Connected:
case EVolatileState::Disconnecting:
DeregisterInDomains();
Hive.UpdateCounterNodesConnected(-1);
break;

default:
Expand Down

0 comments on commit 6466c7e

Please sign in to comment.