-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
spanconfig: teach the KVAccessor about system span configurations #76414
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
97 changes: 97 additions & 0 deletions
97
pkg/spanconfig/spanconfigkvaccessor/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,97 @@ | ||
# Walk through a full set of scenarios pertaining to system span configs. | ||
|
||
# Test with an empty slate. | ||
kvaccessor-get | ||
system-target {cluster} | ||
system-target {source=1,target=1} | ||
system-target {source=1,target=10} | ||
system-target {source=20,target=20} | ||
---- | ||
|
||
# Try deleting a system span configuration that doesn't exist. | ||
kvaccessor-update | ||
delete {cluster} | ||
---- | ||
err: expected to delete 1 row(s), deleted 0 | ||
|
||
# Basic tests that set all possible combinations of system targets. | ||
kvaccessor-update | ||
upsert {cluster}:A | ||
upsert {source=1,target=1}:B | ||
upsert {source=1,target=10}:C | ||
upsert {source=20,target=20}:D | ||
---- | ||
ok | ||
|
||
kvaccessor-get | ||
system-target {cluster} | ||
system-target {source=1,target=1} | ||
system-target {source=1,target=10} | ||
system-target {source=20,target=20} | ||
---- | ||
{cluster}:A | ||
{source=1,target=1}:B | ||
{source=1,target=10}:C | ||
{source=20,target=20}:D | ||
|
||
# Update some of the span configurations that we added and ensure that works. | ||
kvaccessor-update | ||
upsert {cluster}:F | ||
upsert {source=1,target=1}:G | ||
upsert {source=1,target=10}:H | ||
upsert {source=20,target=20}:I | ||
---- | ||
ok | ||
|
||
kvaccessor-get | ||
system-target {cluster} | ||
system-target {source=1,target=1} | ||
system-target {source=1,target=10} | ||
system-target {source=20,target=20} | ||
---- | ||
{cluster}:F | ||
{source=1,target=1}:G | ||
{source=1,target=10}:H | ||
{source=20,target=20}:I | ||
|
||
# Delete all the system span configurations that we just added and ensure | ||
# they take effect. | ||
kvaccessor-update | ||
delete {cluster} | ||
delete {source=1,target=1} | ||
delete {source=1,target=10} | ||
delete {source=20,target=20} | ||
---- | ||
ok | ||
|
||
kvaccessor-get | ||
system-target {cluster} | ||
system-target {source=1,target=1} | ||
system-target {source=1,target=10} | ||
system-target {source=20,target=20} | ||
---- | ||
|
||
# Lastly, try adding multiple system targets set by the host tenant that apply | ||
# to distinct secondary tenants. We also add a system span configuration set by | ||
# one of these secondary tenant's on itself for kicks. | ||
kvaccessor-update | ||
upsert {cluster}:Z | ||
upsert {source=1,target=10}:A | ||
upsert {source=1,target=20}:B | ||
upsert {source=1,target=30}:C | ||
upsert {source=10,target=10}:G | ||
---- | ||
ok | ||
|
||
kvaccessor-get | ||
system-target {cluster} | ||
system-target {source=1,target=10} | ||
system-target {source=1,target=20} | ||
system-target {source=1,target=30} | ||
system-target {source=10,target=10} | ||
---- | ||
{cluster}:Z | ||
{source=1,target=10}:A | ||
{source=1,target=20}:B | ||
{source=1,target=30}:C | ||
{source=10,target=10}:G |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd recommend getting rid of this part of the grammar too. It's not adding anything that isn't represented by {source=1}, something our grammar can already represent. I also have misgivings about spanconfig.MakeClusterTarget. For one, despite the same name, it's wholly different conceptually to ptpb.MakeClusterTarget. We chatted a bit offline about this with @adityamaru, regardless of where we land, simplifying the testdata grammar itself is a good thing IMO.