From 5bad56c202d5a92d18fd99a088aba025ea6acba1 Mon Sep 17 00:00:00 2001 From: wei liu Date: Thu, 21 Nov 2024 22:16:33 +0800 Subject: [PATCH] fix: unstable integration test caused by paramtable.GetNodeID (#37909) issue: #37908 cause paramtable is global single instance, which cause paramtable.GetNodeID may return wrong server id in integration test. This PR use node.GetNodeID to replace paramtable.GetNodeID Signed-off-by: Wei Liu --- internal/querynodev2/delegator/delegator_data.go | 7 ------- internal/querynodev2/services.go | 8 ++++++++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/internal/querynodev2/delegator/delegator_data.go b/internal/querynodev2/delegator/delegator_data.go index db3815718b4b6..b04ab6ab8620c 100644 --- a/internal/querynodev2/delegator/delegator_data.go +++ b/internal/querynodev2/delegator/delegator_data.go @@ -403,13 +403,6 @@ func (sd *shardDelegator) LoadSegments(ctx context.Context, req *querypb.LoadSeg log := sd.getLogger(ctx) targetNodeID := req.GetDstNodeID() - if len(req.GetInfos()) > 0 && req.GetInfos()[0].Level == datapb.SegmentLevel_L0 { - // force l0 segment to load on delegator - if targetNodeID != paramtable.GetNodeID() { - targetNodeID = paramtable.GetNodeID() - log.Info("unexpected L0 segment load on non-delegator node, force to load on delegator", zap.Int64("nodeIDInReq", req.GetDstNodeID())) - } - } // add common log fields log = log.With( zap.Int64("workID", targetNodeID), diff --git a/internal/querynodev2/services.go b/internal/querynodev2/services.go index e3ac0fb7f7ebd..e8b4c8ce251bb 100644 --- a/internal/querynodev2/services.go +++ b/internal/querynodev2/services.go @@ -457,6 +457,14 @@ func (node *QueryNode) LoadSegments(ctx context.Context, req *querypb.LoadSegmen return merr.Status(err), nil } + if len(req.GetInfos()) > 0 && req.GetInfos()[0].Level == datapb.SegmentLevel_L0 { + // force l0 segment to load on delegator + if req.DstNodeID != node.GetNodeID() { + log.Info("unexpected L0 segment load on non-delegator node, force to load on delegator") + req.DstNodeID = node.GetNodeID() + } + } + req.NeedTransfer = false err := delegator.LoadSegments(ctx, req) if err != nil {