-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
server,kvserver,rac2: make ongoing WaitForEvals respond to settings c…
…hange The current config is encapsulated in WaitForEvalConfig, which is passed to rangeController. There are now two "refresh" channels in WaitForEval, (a) the existing one for replica changes, (b) the new one for when the config changes in a manner that narrows the set of work that needs to WaitForEval. The existing code in processorImpl to look at cluster settings is removed. This means the fast path that returns when work does not need to WaitForEval is not as fast as before -- it needs to lookup the rangeController and the rangeController needs to call into WaitForEvalConfig, but it is better not to prematurely optimize by introducing duplicate code. Some additional tracing is added in rangeController.WaitForEval. Epic: CRDB-37515 Release note: None
- Loading branch information
1 parent
3eb415c
commit 9d19bfd
Showing
19 changed files
with
506 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 117 additions & 0 deletions
117
pkg/kv/kvserver/kvflowcontrol/rac2/testdata/range_controller/wait_for_eval_config_change
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
# Initialize a range with voters on s1,s2 and s3. The local replica and | ||
# leaseholder will be s1. The leaseholder is denoted by the '*' suffix. Also | ||
# set streams to initially have 0 tokens and a limit of 8MiB tokens. | ||
init regular_limit=8MiB regular_init=0 elastic_limit=8MiB elastic_init=0 | ||
range_id=1 tenant_id=1 local_replica_id=1 next_raft_index=1 | ||
store_id=1 replica_id=1 type=VOTER_FULL state=StateReplicate next=1 | ||
store_id=2 replica_id=2 type=VOTER_FULL state=StateReplicate next=1 | ||
store_id=3 replica_id=3 type=VOTER_FULL state=StateReplicate next=1 | ||
---- | ||
r1: [(n1,s1):1*,(n2,s2):2,(n3,s3):3] | ||
t1/s1: eval reg=+0 B/+8.0 MiB ela=+0 B/+8.0 MiB | ||
send reg=+0 B/+8.0 MiB ela=+0 B/+8.0 MiB | ||
t1/s2: eval reg=+0 B/+8.0 MiB ela=+0 B/+8.0 MiB | ||
send reg=+0 B/+8.0 MiB ela=+0 B/+8.0 MiB | ||
t1/s3: eval reg=+0 B/+8.0 MiB ela=+0 B/+8.0 MiB | ||
send reg=+0 B/+8.0 MiB ela=+0 B/+8.0 MiB | ||
|
||
# Wait for eval for high priority request 'a'. It is waiting since there are | ||
# no tokens. | ||
wait_for_eval name=a range_id=1 pri=HighPri | ||
---- | ||
range_id=1 tenant_id={1} local_replica_id=1 | ||
name=a pri=high-pri done=false waited=false err=<nil> | ||
|
||
# Disable replication admission control. | ||
set-flow-control-config enabled=false | ||
---- | ||
enabled: false mode: apply_to_all | ||
|
||
# The request stops waiting. | ||
check_state | ||
---- | ||
range_id=1 tenant_id={1} local_replica_id=1 | ||
name=a pri=high-pri done=true waited=false err=<nil> | ||
|
||
# Enable replication admission control. | ||
set-flow-control-config enabled=true | ||
---- | ||
enabled: true mode: apply_to_all | ||
|
||
# Wait for eval for normal priority request 'b'. It is waiting since there are | ||
# no tokens. | ||
wait_for_eval name=b range_id=1 pri=NormalPri | ||
---- | ||
range_id=1 tenant_id={1} local_replica_id=1 | ||
name=a pri=high-pri done=true waited=false err=<nil> | ||
name=b pri=normal-pri done=false waited=false err=<nil> | ||
|
||
# Change replication admission control to only apply to elastic work. | ||
set-flow-control-config mode=apply_to_elastic | ||
---- | ||
enabled: true mode: apply_to_elastic | ||
|
||
# The request stops waiting. | ||
check_state | ||
---- | ||
range_id=1 tenant_id={1} local_replica_id=1 | ||
name=a pri=high-pri done=true waited=false err=<nil> | ||
name=b pri=normal-pri done=true waited=false err=<nil> | ||
|
||
# Restore enabled and apply_to_all. | ||
set-flow-control-config mode=apply_to_all | ||
---- | ||
enabled: true mode: apply_to_all | ||
|
||
# Wait for eval for low priority request 'c'. It is waiting since there are no | ||
# tokens. | ||
wait_for_eval name=c range_id=1 pri=LowPri | ||
---- | ||
range_id=1 tenant_id={1} local_replica_id=1 | ||
name=a pri=high-pri done=true waited=false err=<nil> | ||
name=b pri=normal-pri done=true waited=false err=<nil> | ||
name=c pri=low-pri done=false waited=false err=<nil> | ||
|
||
# Change replication admission control to only apply to elastic work. | ||
set-flow-control-config mode=apply_to_elastic | ||
---- | ||
enabled: true mode: apply_to_elastic | ||
|
||
# The change does not affect request 'c'. | ||
check_state | ||
---- | ||
range_id=1 tenant_id={1} local_replica_id=1 | ||
name=a pri=high-pri done=true waited=false err=<nil> | ||
name=b pri=normal-pri done=true waited=false err=<nil> | ||
name=c pri=low-pri done=false waited=false err=<nil> | ||
|
||
# Change replication admission control to apply to all work. | ||
set-flow-control-config mode=apply_to_all | ||
---- | ||
enabled: true mode: apply_to_all | ||
|
||
# The change does not affect request 'c'. | ||
check_state | ||
---- | ||
range_id=1 tenant_id={1} local_replica_id=1 | ||
name=a pri=high-pri done=true waited=false err=<nil> | ||
name=b pri=normal-pri done=true waited=false err=<nil> | ||
name=c pri=low-pri done=false waited=false err=<nil> | ||
|
||
# Disable replication admission control. | ||
set-flow-control-config enabled=false | ||
---- | ||
enabled: false mode: apply_to_all | ||
|
||
# The request stops waiting. | ||
check_state | ||
---- | ||
range_id=1 tenant_id={1} local_replica_id=1 | ||
name=a pri=high-pri done=true waited=false err=<nil> | ||
name=b pri=normal-pri done=true waited=false err=<nil> | ||
name=c pri=low-pri done=true waited=false err=<nil> | ||
|
||
# Restore settings. | ||
set-flow-control-config enabled=true | ||
---- | ||
enabled: true mode: apply_to_all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.