From 1d0152784cad56da59a359d3d22056b1258daad6 Mon Sep 17 00:00:00 2001 From: "zhenshan.cao" Date: Tue, 21 Jul 2026 20:22:34 -0700 Subject: [PATCH] fix: honor --dstNodes in balance-segment `BalanceSegmentCommand` parsed the destination flag into `p.DstNodes` but never put it into the `LoadBalanceRequest`, so the flag was silently ignored and querycoord always fell back to picking a destination among all nodes of the replica (`DstNodeIDs` empty means "any RW node"). Verified against a local Milvus 2.6.19 cluster: running `balance-segment --collection C --segment S --srcNodes 10 --dstNode 8` returned success but the segment landed on node 11, not node 8. Populate `DstNodeIDs` from the flag. `DstNodes` is now `[]int64` / `--dstNodes`, mirroring `SourceNodes` / `--srcNodes` and the repeated `DstNodeIDs` field in the proto; an empty value keeps the previous auto-select behaviour. Co-Authored-By: Claude Opus 4.8 Signed-off-by: zhenshan.cao --- states/mgrpc/querycoord.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/states/mgrpc/querycoord.go b/states/mgrpc/querycoord.go index d8bd9a8d..646c14c0 100644 --- a/states/mgrpc/querycoord.go +++ b/states/mgrpc/querycoord.go @@ -36,7 +36,7 @@ type BalanceSegmentParam struct { CollectionID int64 `name:"collection" default:"0"` SegmentIDs []int64 `name:"segment" desc:"segment ids to balance"` SourceNodes []int64 `name:"srcNodes" desc:"from querynode ids"` - DstNodes int64 `name:"dstNode" desc:"to querynode ids"` + DstNodes []int64 `name:"dstNodes" desc:"to querynode ids, empty means let querycoord pick"` } func (s *queryCoordState) BalanceSegmentCommand(ctx context.Context, p *BalanceSegmentParam) error { @@ -47,6 +47,8 @@ func (s *queryCoordState) BalanceSegmentCommand(ctx context.Context, p *BalanceS CollectionID: p.CollectionID, SealedSegmentIDs: p.SegmentIDs, SourceNodeIDs: p.SourceNodes, + // Empty DstNodeIDs makes querycoord pick a target among all nodes of the replica. + DstNodeIDs: p.DstNodes, } resp, err := s.client.LoadBalance(ctx, req)