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 <wei.liu@zilliz.com>
This commit is contained in:
wei liu 2024-11-21 22:16:33 +08:00 committed by GitHub
parent 1dc1a97e65
commit 5f3601a6a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 7 deletions

View File

@ -403,13 +403,6 @@ func (sd *shardDelegator) LoadSegments(ctx context.Context, req *querypb.LoadSeg
log := sd.getLogger(ctx) log := sd.getLogger(ctx)
targetNodeID := req.GetDstNodeID() 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 // add common log fields
log = log.With( log = log.With(
zap.Int64("workID", targetNodeID), zap.Int64("workID", targetNodeID),

View File

@ -457,6 +457,14 @@ func (node *QueryNode) LoadSegments(ctx context.Context, req *querypb.LoadSegmen
return merr.Status(err), nil 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 req.NeedTransfer = false
err := delegator.LoadSegments(ctx, req) err := delegator.LoadSegments(ctx, req)
if err != nil { if err != nil {