fix: L0 segment has been loaded to worker during channel balance (#37758)

issue: https://github.com/milvus-io/milvus/issues/37703
pr: https://github.com/milvus-io/milvus/pull/37748

---------

Signed-off-by: Wei Liu <wei.liu@zilliz.com>
This commit is contained in:
wei liu 2024-11-18 17:00:32 +08:00 committed by GitHub
parent cabb55595a
commit 2a4f54cd4f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -393,9 +393,16 @@ 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", req.GetDstNodeID()),
zap.Int64("workID", targetNodeID),
zap.Int64s("segments", lo.Map(req.GetInfos(), func(info *querypb.SegmentLoadInfo, _ int) int64 { return info.GetSegmentID() })),
)
@ -405,7 +412,7 @@ func (sd *shardDelegator) LoadSegments(ctx context.Context, req *querypb.LoadSeg
return err
}
req.Base.TargetID = req.GetDstNodeID()
req.Base.TargetID = targetNodeID
log.Debug("worker loads segments...")
sLoad := func(ctx context.Context, req *querypb.LoadSegmentsRequest) error {