Skip to content

Commit

Permalink
fix: unstable integration test caused by paramtable.GetNodeID (milvus…
Browse files Browse the repository at this point in the history
…-io#37909)

issue: milvus-io#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 <[email protected]>
  • Loading branch information
weiliu1031 authored Nov 21, 2024
1 parent 1dc1a97 commit 5f3601a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
7 changes: 0 additions & 7 deletions internal/querynodev2/delegator/delegator_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
8 changes: 8 additions & 0 deletions internal/querynodev2/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 5f3601a

Please sign in to comment.