From 5dcff9ab72acdb84c0337bb5f70034a1b9bdffd6 Mon Sep 17 00:00:00 2001 From: yah01 Date: Thu, 20 Oct 2022 10:07:30 +0800 Subject: [PATCH] Fix QueryNode panic when meta changed (#19902) Signed-off-by: yah01 Signed-off-by: yah01 --- internal/querynode/flow_graph_delete_node.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/internal/querynode/flow_graph_delete_node.go b/internal/querynode/flow_graph_delete_node.go index f3f34474df..bfcff752ae 100644 --- a/internal/querynode/flow_graph_delete_node.go +++ b/internal/querynode/flow_graph_delete_node.go @@ -83,8 +83,11 @@ func (dNode *deleteNode) Operate(in []flowgraph.Msg) []flowgraph.Msg { collection, err := dNode.metaReplica.getCollectionByID(dNode.collectionID) if err != nil { - // QueryNode should add collection before start flow graph - panic(fmt.Errorf("%s getCollectionByID failed, collectionID = %d, channel = %s", dNode.Name(), dNode.collectionID, dNode.channel)) + log.Warn("failed to get collection", + zap.Int64("collectionID", dNode.collectionID), + zap.String("channel", dNode.channel), + ) + return []Msg{} } collection.RLock() defer collection.RUnlock() @@ -120,9 +123,12 @@ func (dNode *deleteNode) Operate(in []flowgraph.Msg) []flowgraph.Msg { segment, err := dNode.metaReplica.getSegmentByID(segmentID, segmentTypeSealed) if err != nil { // should not happen, segment should be created before - err = fmt.Errorf("deleteNode getSegmentByID failed, err = %s", err) - log.Error(err.Error()) - panic(err) + log.Warn("failed to get segment", + zap.Int64("collectionID", dNode.collectionID), + zap.Int64("segmentID", segmentID), + zap.String("channel", dNode.channel), + ) + continue } offset := segment.segmentPreDelete(len(pks)) delData.deleteOffset[segmentID] = offset