fix: honor --dstNodes in balance-segment - #508
Conversation
|
@czs007 Thanks for your contribution. Please submit with DCO, see the contributing guide https://github.com/milvus-io/milvus/blob/master/CONTRIBUTING.md#developer-certificate-of-origin-dco. |
2870eab to
0e10a28
Compare
|
Tick the box to add this pull request to the merge queue (same as
|
| 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:"dstNode" default:"0" desc:"to querynode id, 0 means let querycoord pick"` |
There was a problem hiding this comment.
can we use []int64 like SourceNodes for DstNodes?
There was a problem hiding this comment.
Good catch, done in 1d01527.
DstNodes is now []int64 with flag --dstNodes, mirroring SourceNodes / --srcNodes and the repeated DstNodeIDs field in the proto. This also lets the 0 sentinel and the if p.DstNodes != 0 branch go away — an empty slice already means "let querycoord pick".
I renamed the flag from --dstNode to --dstNodes for symmetry; nothing depended on the old spelling since the value was never sent to querycoord in the first place. Happy to keep --dstNode as the flag name if you would rather not change it.
Backport #509 is updated the same way.
`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 <noreply@anthropic.com> Signed-off-by: zhenshan.cao <zhenshan.cao@zilliz.com>
0e10a28 to
1d01527
Compare
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: congqixia, czs007 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Backport of #508 to `v1.1.x`. `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"). Populate `DstNodeIDs` from the flag. Per review feedback on #508, `DstNodes` is `[]int64` with flag `--dstNodes`, mirroring `SourceNodes` / `--srcNodes` and the repeated `DstNodeIDs` field in the proto; an empty value keeps the previous auto-select behaviour. Cherry-picked from 1d01527. Signed-off-by: zhenshan.cao <zhenshan.cao@zilliz.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
What
balance-segmentaccepts a destination-node flag, but the value was never sent to querycoord.BalanceSegmentCommandparses the flag intop.DstNodesand then builds the request without it:On the server side, an empty
DstNodeIDsmeans "any RW node of the replica" — querycoord insertsreplica.GetRWNodes()into the destination set and lets the assign policy pick. So the flag is silently ignored and the caller gets a destination they did not ask for, with no error.Repro
Against a local Milvus 2.6.19 cluster (3 querynodes: 8, 10, 11):
Fix
Populate
DstNodeIDsfrom the flag.Per review feedback,
DstNodesis[]int64with flag--dstNodes, mirroringSourceNodes/--srcNodesand the repeatedDstNodeIDsfield in the proto. An empty value keeps the previous behaviour (let querycoord pick), so existing usage is unaffected — and nothing could have depended on the old--dstNodespelling, since the value was never sent.Test
Rebuilt and re-ran the same command against the same cluster; the segment now lands on the requested node.
go build ./...andgofmtclean.Backport to
v1.1.x: #509.