Skip to content

Commit ab5a43f

Browse files
committed
mmaprototype: allow rebalancing between stores on the same node
Previously, when MMA constructed the candidate set, it excluded stores on nodes that already had replicas, including the current node itself. However, rebalancing replicas across different stores on the same node should be allowed. This commit corrects that logic. Note that the store itself has already been excluded earlier (see https://github.com/cockroachdb/cockroach/blob/da4a31068dc9f268d423aa4d5fd72b29c61942bc/pkg/kv/kvserver/allocator/mmaprototype/allocator_state.go#L614-L623).
1 parent 04ccf4b commit ab5a43f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,12 @@ func (a *allocatorState) rebalanceStores(
673673
// Also exclude all stores on nodes that have existing replicas.
674674
for _, replica := range rstate.replicas {
675675
storeID := replica.StoreID
676+
if storeID == store.StoreID {
677+
// We don't exclude other stores on this node, since we are allowed to
678+
// transfer the range to them. If the node is overloaded or not fdOK,
679+
// we have already excluded those stores above.
680+
continue
681+
}
676682
nodeID := a.cs.stores[storeID].NodeID
677683
for _, storeID := range a.cs.nodes[nodeID].stores {
678684
storesToExcludeForRange.insert(storeID)

0 commit comments

Comments
 (0)