Skip to content

Commit

Permalink
fix: unstable integration test caused by paramtable.GetNodeID (#37910)
Browse files Browse the repository at this point in the history
issue: #37908
pr: #37909
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 22, 2024
1 parent 0bd2617 commit e63a2f3
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 @@ -384,13 +384,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 @@ -456,6 +456,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 e63a2f3

Please sign in to comment.