Skip to content

Commit 7b2f455

Browse files
craig[bot]wenyihu6
andcommitted
Merge #158156
158156: mmaprototype: use voterIndex when selecting a voter to be removed r=wenyihu6 a=wenyihu6 Epic: CRDB-55052 Release note: none Fixes: #157991 --- **mmaprototype: use voterIndex when selecting a voter to be removed** Previously, we were incorrectly using nonVoterIndex when selecting a voter to remove in over-satisfied scenarios. While attempting to write tests, it appears that this code is actually unreachable under normal flow: for it to trigger, both replica constraints and voter constraints would need to be empty, but makeNormalizedSpanConfig ensures voter constraints is non-empty when all replica constraint is empty. Things remain to be figured out, but this change does not harm. Co-authored-by: wenyihu6 <[email protected]>
2 parents a652bfc + 649ad4a commit 7b2f455

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/kv/kvserver/allocator/mmaprototype/constraint_unused_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,9 @@ func (rac *rangeAnalyzedConstraints) candidatesToRemove() ([]roachpb.StoreID, er
347347
}
348348
// No constraints. Can remove any voter.
349349
for i := range rac.replicas[voterIndex] {
350-
cands = append(cands, rac.replicas[nonVoterIndex][i].StoreID)
350+
cands = append(cands, rac.replicas[voterIndex][i].StoreID)
351351
}
352-
return cands, nil
352+
panic("impossible to be here")
353353
}
354354
return nil, nil
355355
}

0 commit comments

Comments
 (0)