[vtctldserver] Migrate routing rules RPCs, and also RebuildVSchemaGraph#8197
Merged
ajm188 merged 6 commits intovitessio:masterfrom Jun 1, 2021
Merged
Conversation
39eafd8 to
c7243f6
Compare
added 6 commits
June 1, 2021 16:39
…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>
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, ", ")) |
ajm188
pushed 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
This file contains hidden or 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
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
VtctldServerimplementation, and reimplements the corresponding vtctl commands to use the new implementation under the hood:ApplyRoutingRulesGetRoutingRulesRebuildVSchemaGraphI also took this opportunity to add a
-dry-runflag to the vtctl commandApplyRoutingRulesto 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