-
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.
(replica_)rac2: add send stream stats method
Add a new method to the `RangeController`, `SendStreamStats()`, which returns a map of replica IDs -> replica send stream stats: ``` // ReplicaSendStreamStats contains the stats for a replica send stream that may // be used to inform placement decisions pertaining to the replica. type ReplicaSendStreamStats struct { // IsStateReplicate is true iff the replica is being sent entries. IsStateReplicate bool // HasSendQueue is true when a replica has a non-zero amount of queued // entries waiting on flow tokens to be sent. // // This is only populated when IsStateReplicate is true. HasSendQueue bool } ``` This method can be used to determine appropriate lease transfer targets. Part of: #128028 Release note: None
- Loading branch information
Showing
6 changed files
with
150 additions
and
0 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
65 changes: 65 additions & 0 deletions
65
pkg/kv/kvserver/kvflowcontrol/rac2/testdata/range_controller/send_stream_stats
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,65 @@ | ||
# This test verifies that the RangeController correctly returns whether a | ||
# replica's send queue bytes and whether the send stream is closed. | ||
# | ||
# s2 is in StateSnapshot so its send stream should be closed. | ||
# s3 has a send queue via sending only a prefix of entries [1,2). | ||
init | ||
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=StateSnapshot 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=+16 MiB/+16 MiB ela=+8.0 MiB/+8.0 MiB | ||
send reg=+16 MiB/+16 MiB ela=+8.0 MiB/+8.0 MiB | ||
t1/s2: eval reg=+16 MiB/+16 MiB ela=+8.0 MiB/+8.0 MiB | ||
send reg=+16 MiB/+16 MiB ela=+8.0 MiB/+8.0 MiB | ||
t1/s3: eval reg=+16 MiB/+16 MiB ela=+8.0 MiB/+8.0 MiB | ||
send reg=+16 MiB/+16 MiB ela=+8.0 MiB/+8.0 MiB | ||
|
||
raft_event | ||
range_id=1 | ||
entries | ||
term=1 index=1 pri=NormalPri size=1MiB | ||
term=1 index=2 pri=NormalPri size=1MiB | ||
term=1 index=3 pri=NormalPri size=1MiB | ||
sending | ||
replica_id=1 [1,4) | ||
replica_id=2 [1,4) | ||
replica_id=2 [1,2) | ||
---- | ||
t1/s1: eval reg=+13 MiB/+16 MiB ela=+5.0 MiB/+8.0 MiB | ||
send reg=+13 MiB/+16 MiB ela=+5.0 MiB/+8.0 MiB | ||
t1/s2: eval reg=+16 MiB/+16 MiB ela=+8.0 MiB/+8.0 MiB | ||
send reg=+16 MiB/+16 MiB ela=+8.0 MiB/+8.0 MiB | ||
t1/s3: eval reg=+13 MiB/+16 MiB ela=+5.0 MiB/+8.0 MiB | ||
send reg=+16 MiB/+16 MiB ela=+8.0 MiB/+8.0 MiB | ||
|
||
stream_state range_id=1 | ||
---- | ||
(n1,s1):1: state=replicate closed=false inflight=[1,4) send_queue=[4,4) precise_q_size=+0 B force-flush=false | ||
eval deducted: reg=+3.0 MiB ela=+0 B | ||
eval original in send-q: reg=+0 B ela=+0 B | ||
NormalPri: | ||
term=1 index=1 tokens=1048576 | ||
term=1 index=2 tokens=1048576 | ||
term=1 index=3 tokens=1048576 | ||
++++ | ||
(n2,s2):2: closed | ||
++++ | ||
(n3,s3):3: state=replicate closed=false inflight=[1,1) send_queue=[1,4) precise_q_size=+3.0 MiB force-flush=false | ||
eval deducted: reg=+3.0 MiB ela=+0 B | ||
eval original in send-q: reg=+3.0 MiB ela=+0 B | ||
++++ | ||
|
||
# TODO(kvoli): When we introduce the send queue fully, this should change to | ||
# send_queue_bytes=2 MiB for s3. | ||
send_stream_stats range_id=1 | ||
---- | ||
(n1,s1):1: is_state_replicate=true has_send_queue=false | ||
(n2,s2):2: is_state_replicate=false has_send_queue=true | ||
(n3,s3):3: is_state_replicate=true has_send_queue=true | ||
|
||
close_rcs | ||
---- | ||
range_id=1 tenant_id={1} local_replica_id=1 |
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