From f6411abbd7feb115d0d35f01cfd022f40b60a5ce Mon Sep 17 00:00:00 2001 From: Zhen Ye Date: Thu, 20 Nov 2025 11:07:06 +0800 Subject: [PATCH] fix: panic when streaming coord shutdown but query coord still work (#45695) issue: #44984 Signed-off-by: chyezh --- internal/coordinator/snmanager/streaming_node_manager.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/coordinator/snmanager/streaming_node_manager.go b/internal/coordinator/snmanager/streaming_node_manager.go index c95285ea07..1ffc6ae497 100644 --- a/internal/coordinator/snmanager/streaming_node_manager.go +++ b/internal/coordinator/snmanager/streaming_node_manager.go @@ -67,6 +67,7 @@ type StreamingNodeManager struct { cond *syncutil.ContextCond latestAssignments map[string]types.PChannelInfoAssigned // The latest assignments info got from streaming coord balance module. nodeChangedNotifier *syncutil.VersionedNotifier // used to notify that node in streaming node manager has been changed. + previousNodeIDs typeutil.UniqueSet // used to store the previous node ids. } // GetBalancer returns the balancer of the streaming node manager. @@ -151,12 +152,15 @@ func (s *StreamingNodeManager) GetStreamingQueryNodeIDs() typeutil.UniqueSet { } streamingNodes, err := balancer.GetAllStreamingNodes(context.Background()) if err != nil { - panic(err) + // when the streaming coord is on shutdown, the balancer will return an error, + // causing panic, so we need to return the previous node ids. + return s.previousNodeIDs } streamingNodeIDs := typeutil.NewUniqueSet() for _, streamingNode := range streamingNodes { streamingNodeIDs.Insert(streamingNode.ServerID) } + s.previousNodeIDs = streamingNodeIDs return streamingNodeIDs }