-
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.
spanconfigkvsubscriber: teach the KVSubscriber about system span configs
This patch teaches the KVSubscriber to handle updates to system span configurations. There's not much here, other than invoking registered handlers with the correct span when a system span config is updated. This entails: - The everything span when the system span config targets the entire keyspace or targets the host tenant. - The targeted tenant's span if the system span config targets a secondary tenant. Also fix a bug where we weren't correclty initializing handlers. Release note: None
- Loading branch information
1 parent
0c00289
commit b83e5b3
Showing
8 changed files
with
198 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ start | |
|
||
updates | ||
---- | ||
/M{in-ax} | ||
[/Min,/Max) | ||
|
||
store-reader key=a | ||
---- | ||
|
127 changes: 127 additions & 0 deletions
127
pkg/spanconfig/spanconfigkvsubscriber/testdata/system_span_configs
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,127 @@ | ||
|
||
start | ||
---- | ||
|
||
update | ||
upsert [a,c):A | ||
upsert [d,f):D | ||
---- | ||
|
||
updates | ||
---- | ||
[/Min,/Max) | ||
[a,c) | ||
[d,f) | ||
|
||
store-reader key=a | ||
---- | ||
conf=A | ||
|
||
store-reader key=e | ||
---- | ||
conf=D | ||
|
||
store-reader key=g | ||
---- | ||
conf=MISSING | ||
|
||
update | ||
upsert {entire-keyspace}:+X | ||
---- | ||
|
||
updates | ||
---- | ||
[/Min,/Max) | ||
|
||
store-reader key=a | ||
---- | ||
conf=A+X | ||
|
||
store-reader key=e | ||
---- | ||
conf=D+X | ||
|
||
# The system span config we set should still apply. | ||
store-reader key=g | ||
---- | ||
conf=MISSING+X | ||
|
||
# Update span configs that target tenant keyspaces and ensure handlers are | ||
# invoked correctly. | ||
update | ||
upsert {source=1, target=1}:+Y | ||
upsert {source=1,target=20}:+Z | ||
upsert {source=10, target=10}:+W | ||
---- | ||
|
||
# [/Min,/Tenant/2] corresponds to the system tenant targeting itself. | ||
updates | ||
---- | ||
[/Min,/Tenant/2) | ||
[/Tenant/10,/Tenant/11) | ||
[/Tenant/20,/Tenant/21) | ||
|
||
# Ensure configs are correctly hydrated when we read them. | ||
store-reader key=a | ||
---- | ||
conf=A+X+Y | ||
|
||
store-reader key=e | ||
---- | ||
conf=D+X+Y | ||
|
||
# Delete the system span config over the entire keyspace and ensure handlers are | ||
# invoked correctly + configs for various keys are correctly hydrated. | ||
update | ||
delete {entire-keyspace} | ||
---- | ||
|
||
updates | ||
---- | ||
[/Min,/Max) | ||
|
||
store-reader key=a | ||
---- | ||
conf=A+Y | ||
|
||
store-reader key=e | ||
---- | ||
conf=D+Y | ||
|
||
# Delete system span configs that target secondary and ensure handlers are | ||
# invoked correctly. | ||
update | ||
delete {source=1,target=20} | ||
---- | ||
|
||
updates | ||
---- | ||
[/Tenant/20,/Tenant/21) | ||
|
||
# Update system span config, ensure handlers are correctly invoked, and configs | ||
# are hydrated correctly. | ||
update | ||
upsert {source=1, target=1}:+V | ||
---- | ||
|
||
updates | ||
---- | ||
[/Min,/Tenant/2) | ||
|
||
store-reader key=a | ||
---- | ||
conf=A+V | ||
|
||
store-reader key=e | ||
---- | ||
conf=D+V | ||
|
||
# Lastly, update a system span config set on a secondary tenant's keyspace and | ||
# ensure handlers are invoked correctly. | ||
update | ||
upsert {source=10, target=10}:+U | ||
---- | ||
|
||
updates | ||
---- | ||
[/Tenant/10,/Tenant/11) |
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