Skip to content

Commit c128d9e

Browse files
committed
mmaprototype: make numtopkreplicas configurable in test
It was hard-coded to two (in the test), but I want to be able to change it for an improved lease rebalancing test that I'm adding.
1 parent 631d60a commit c128d9e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,11 @@ func TestClusterState(t *testing.T) {
444444

445445
case "store-leaseholder-msg":
446446
msg := parseStoreLeaseholderMsg(t, d.Input)
447-
cs.processStoreLeaseholderMsgInternal(context.Background(), &msg, 2, nil)
447+
n := numTopKReplicas
448+
if o, ok := dd.ScanArgOpt[int](t, d, "num-top-k-replicas"); ok {
449+
n = o
450+
}
451+
cs.processStoreLeaseholderMsgInternal(context.Background(), &msg, n, nil)
448452
return ""
449453

450454
case "make-pending-changes":

pkg/kv/kvserver/allocator/mmaprototype/testdata/cluster_state/multiple_ranges.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ store-load-msg
1717
----
1818

1919
# Range 4 has the highest cpu on the leaseholder, and range 3 the highest cpu on a follower.
20-
store-leaseholder-msg
20+
store-leaseholder-msg num-top-k-replicas=2
2121
store-id=1
2222
range-id=1 load=[10,10,20] raft-cpu=5 config=(num_replicas=3 constraints={'+region=us-west-1:1'} voter_constraints={'+region=us-west-1:1'})
2323
store-id=1 replica-id=1 type=VOTER_FULL leaseholder=true

0 commit comments

Comments
 (0)