-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[vtctldserver] Migrate routing rules RPCs, and also RebuildVSchemaGraph
#8197
Merged
ajm188
merged 6 commits into
vitessio:master
from
tinyspeck:am_vtctldserver_routingrules
Jun 1, 2021
Merged
[vtctldserver] Migrate routing rules RPCs, and also RebuildVSchemaGraph
#8197
ajm188
merged 6 commits into
vitessio:master
from
tinyspeck:am_vtctldserver_routingrules
Jun 1, 2021
Conversation
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
ajm188
force-pushed
the
am_vtctldserver_routingrules
branch
4 times, most recently
from
June 1, 2021 01:44
39eafd8
to
c7243f6
Compare
…rver and run generators Signed-off-by: Andrew Mason <amason@slack-corp.com>
…ests Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
…mmands using VtctldServer Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
ajm188
force-pushed
the
am_vtctldserver_routingrules
branch
from
June 1, 2021 20:43
c7243f6
to
8536013
Compare
doeg
approved these changes
Jun 1, 2021
if len(applyRoutingRulesOptions.Cells) == 0 { | ||
fmt.Print(" in all cells\n") | ||
} else { | ||
fmt.Printf(" in the following cells: %s.\n", strings.Join(applyRoutingRulesOptions.Cells, ", ")) |
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.
The details ✨
ajm188
added a commit
to tinyspeck/vitess
that referenced
this pull request
Jul 23, 2021
…ngrules [vtctldserver] Migrate routing rules RPCs, and also `RebuildVSchemaGraph` Signed-off-by: Andrew Mason <amason@slack-corp.com>
8 tasks
33 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR migrates the following RPCs to the
VtctldServer
implementation, and reimplements the corresponding vtctl commands to use the new implementation under the hood:ApplyRoutingRules
GetRoutingRules
RebuildVSchemaGraph
I also took this opportunity to add a
-dry-run
flag to the vtctl commandApplyRoutingRules
to tackle #7958 as part of this change.In Action
new client functionality
``` ❯ vtctldclient --server "localhost:15999" GetRoutingRules { "rules": [] } ❯ vtctldclient --server "localhost:15999" RebuildVSchemaGraph RebuildVSchemaGraph: ok ❯ vtctldclient --server "localhost:15999" ApplyRoutingRules -r '{"rules": [{"from_table": "t1", "to_tables": ["t2", "t3"]}]}' New RoutingRules object: { "rules": [ { "from_table": "t1", "to_tables": [ "t2", "t3" ] } ] } If this is not what you expected, check the input data (as JSON parsing will skip unexpected fields). ❯ vtctldclient --server "localhost:15999" GetRoutingRules { "rules": [ { "from_table": "t1", "to_tables": [ "t2", "t3" ] } ] } ❯ vtctldclient --server "localhost:15999" ApplyRoutingRules -r '{"rules": [{"from_table": "t1", "to_tables": ["t2", "t3", "t4]}]}' --skip-rebuild E0527 06:22:11.987119 73190 main.go:42] line: 1, position 65: unexpected end of JSON input ❯ vtctldclient --server "localhost:15999" ApplyRoutingRules -r '{"rules": [{"from_table": "t1", "to_tables": ["t2", "t3", "t4"]}]}' --skip-rebuild New RoutingRules object: { "rules": [ { "from_table": "t1", "to_tables": [ "t2", "t3", "t4" ] } ] } If this is not what you expected, check the input data (as JSON parsing will skip unexpected fields). Skipping rebuild of VSchema graph, will need to run RebuildVSchemaGraph for changes to take effect. ```File-based rules in new client
``` ❯ vtctldclient --server "localhost:15999" GetRoutingRules > routing_rules.json ❯ vim routing_rules.json ❯ cat routing_rules.json { "rules": [ { "from_table": "t1", "to_tables": [ "t2" ] } ] } ❯ vtctldclient --server "localhost:15999" ApplyRoutingRules -f routing_rules.json New RoutingRules object: { "rules": [ { "from_table": "t1", "to_tables": [ "t2" ] } ] } If this is not what you expected, check the input data (as JSON parsing will skip unexpected fields). ❯ vtctldclient --server "localhost:15999" GetRoutingRules { "rules": [ { "from_table": "t1", "to_tables": [ "t2" ] } ] } ```Old client
``` ❯ vtctlclient -server "localhost:15999" GetRoutingRules {} ❯ vtctlclient -server "localhost:15999" ApplyRoutingRules -rules '{"rules": [{"from_table": "t1", "to_tables": ["t2", "t3", "t4"]}]}' New RoutingRules object: { "rules": [ { "fromTable": "t1", "toTables": [ "t2", "t3", "t4" ] } ] } If this is not what you expected, check the input data (as JSON parsing will skip unexpected fields). ❯ vtctlclient -server "localhost:15999" GetRoutingRules { "rules": [ { "fromTable": "t1", "toTables": [ "t2", "t3", "t4" ] } ] } ```Old client with dry-run
``` ❯ vtctlclient -server "localhost:15999" ApplyRoutingRules -rules '{"rules": [{"from_table": "t1", "to_tables": ["t2", "t3", "t4"]}]}' -dry-run === DRY RUN === New RoutingRules object: { "rules": [ { "fromTable": "t1", "toTables": [ "t2", "t3", "t4" ] } ] } If this is not what you expected, check the input data (as JSON parsing will skip unexpected fields). === (END) DRY RUN === ❯ vtctlclient -server "localhost:15999" ApplyRoutingRules -rules '{"rules": [{"from_table": "t1", "to_tables": ["t2", "t3", "t4"]}]}' -dry-run -skip_rebuild === DRY RUN === New RoutingRules object: { "rules": [ { "fromTable": "t1", "toTables": [ "t2", "t3", "t4" ] } ] } If this is not what you expected, check the input data (as JSON parsing will skip unexpected fields). === (END) DRY RUN === W0527 08:28:28.695105 85989 main.go:67] W0527 12:28:28.694526 vtctl.go:3323] DRY RUN: Skipping rebuild of SrvVSchema, will need to run RebuildVSchemaGraph for changes to take effect ❯ vtctlclient -server "localhost:15999" GetRoutingRules {} ```Related Issue(s)
Closes #8196
Fixes #7958
Checklist
Deployment Notes