mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-07 17:48:29 +08:00
fix: only clear exclude node list after refresh shard leader cache (#43553)
issue: #43511 Signed-off-by: Wei Liu <wei.liu@zilliz.com>
This commit is contained in:
parent
5cebc9f7f6
commit
369a811ae1
@ -144,7 +144,7 @@ func (lb *LBPolicyImpl) selectNode(ctx context.Context, balancer LBBalancer, wor
|
|||||||
|
|
||||||
// if all available delegator has been excluded even after refresh shard leader cache
|
// if all available delegator has been excluded even after refresh shard leader cache
|
||||||
// we should clear excludeNodes and try to select node again instead of failing the request at selectNode
|
// we should clear excludeNodes and try to select node again instead of failing the request at selectNode
|
||||||
if len(shardLeaders) > 0 && len(shardLeaders) <= excludeNodes.Len() {
|
if !withCache && len(shardLeaders) > 0 && len(shardLeaders) <= excludeNodes.Len() {
|
||||||
allReplicaExcluded := true
|
allReplicaExcluded := true
|
||||||
for _, node := range shardLeaders {
|
for _, node := range shardLeaders {
|
||||||
if !excludeNodes.Contain(node.nodeID) {
|
if !excludeNodes.Contain(node.nodeID) {
|
||||||
|
|||||||
@ -663,8 +663,6 @@ func (s *LBPolicySuite) TestSelectNodeWithExcludeClearing() {
|
|||||||
s.lbBalancer.ExpectedCalls = nil
|
s.lbBalancer.ExpectedCalls = nil
|
||||||
s.lbBalancer.EXPECT().RegisterNodeInfo(mock.Anything)
|
s.lbBalancer.EXPECT().RegisterNodeInfo(mock.Anything)
|
||||||
// First attempt fails due to no candidates
|
// First attempt fails due to no candidates
|
||||||
s.lbBalancer.EXPECT().SelectNode(mock.Anything, mock.Anything, mock.Anything).Return(-1, merr.ErrNodeNotAvailable).Times(1)
|
|
||||||
// Second attempt succeeds after exclude nodes are cleared
|
|
||||||
s.lbBalancer.EXPECT().SelectNode(mock.Anything, mock.Anything, mock.Anything).Return(1, nil).Times(1)
|
s.lbBalancer.EXPECT().SelectNode(mock.Anything, mock.Anything, mock.Anything).Return(1, nil).Times(1)
|
||||||
|
|
||||||
// Setup mock to return only excluded nodes first, then same nodes for retry
|
// Setup mock to return only excluded nodes first, then same nodes for retry
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user