From 5f5560d0421eb05142f9437baf85af168e899115 Mon Sep 17 00:00:00 2001 From: congqixia Date: Mon, 1 Dec 2025 11:09:08 +0800 Subject: [PATCH] fix: always call handleNodeUp in rewatchNodes for proper stopping balance (#45961) Related to #45960 When QueryCoord restarts or reconnects to etcd, the rewatchNodes function previously skipped handleNodeUp for QueryNodes in stopping state. This caused stopping balance to fail because necessary components were not initialized: - Task scheduler executor was not added - Dist handler was not started - Node was not registered in resource manager This fix ensures handleNodeUp is always called for new nodes regardless of their stopping state, followed by handleNodeStopping if the node is stopping. This allows the graceful shutdown process to correctly migrate segments and channels away from stopping nodes. Signed-off-by: Congqi Xia --- internal/querycoordv2/server.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/querycoordv2/server.go b/internal/querycoordv2/server.go index 51567ac5d4..311003eb93 100644 --- a/internal/querycoordv2/server.go +++ b/internal/querycoordv2/server.go @@ -734,11 +734,13 @@ func (s *Server) rewatchNodes(sessions map[string]*sessionutil.Session) error { Labels: nodeSession.GetServerLabel(), })) + // call handleNodeUp no matter what state new querynode is in + // all component need this op so that stopping balance could work correctly + s.handleNodeUp(nodeSession.GetServerID()) + if nodeSession.Stopping { s.nodeMgr.Stopping(nodeSession.ServerID) s.handleNodeStopping(nodeSession.ServerID) - } else { - s.handleNodeUp(nodeSession.GetServerID()) } } }