Skip to content

[vtctldserver] Migrate CellInfo, CellAlias rw RPCs#8219

Merged
ajm188 merged 4 commits intovitessio:masterfrom
tinyspeck:am_cell_rw_rpcs
Jun 1, 2021
Merged

[vtctldserver] Migrate CellInfo, CellAlias rw RPCs#8219
ajm188 merged 4 commits intovitessio:masterfrom
tinyspeck:am_cell_rw_rpcs

Conversation

@ajm188
Copy link
Contributor

@ajm188 ajm188 commented May 31, 2021

Description

This migrates the read-write cell and cell alias vtctl commands to the grpc vtctldserver, namely:

  • AddCellInfo
  • AddCellsAlias
  • DeleteCellInfo
  • DeleteCellsAlias
  • UpdateCellInfo
  • UpdateCellsAlias

Note, there is an underlying issue in the (*topo.Server).DeleteCellInfo method, which I'm filing a bug for, and will link back here when I do.

Example usage
❯ vtctldclient --server "localhost:15999" GetCellInfo zone1
{
  "server_address": "127.0.0.1:2379",
  "root": "/vitess/zone1"
}
❯ vtctldclient --server "localhost:15999" AddCellInfo -r "/vitess/zone2" zone2
Created cell: zone2
❯ vtctldclient --server "localhost:15999" GetCellInfo zone2
{
  "server_address": "",
  "root": "/vitess/zone2"
}
❯ vtctldclient --server "localhost:15999" UpdateCellInfo zone2 -a "127.0.0.1:19999"
Updated cell zone2. New CellInfo:
{
  "server_address": "127.0.0.1:19999",
  "root": "/vitess/zone2"
}
❯ vtctldclient --server "localhost:15999" AddCellsAlias -c zone1 -c zone2 megazone
Created cells alias: megazone (cells = [zone1 zone2])

Related Issue(s)

Checklist

  • Tests were added or are not required
  • Documentation was added or is not required

Deployment Notes

Andrew Mason added 4 commits May 31, 2021 21:24
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>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
@ajm188 ajm188 force-pushed the am_cell_rw_rpcs branch from af546fa to a36e2ce Compare June 1, 2021 01:24
}
// AddCellsAlias makes an AddCellsAlias gRPC call to a vtctld.
AddCellsAlias = &cobra.Command{
Use: "AddCellsAlias --cells <cell1,cell2,...> [--cells <cell3> ...] <alias>",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious: why is the --cells flag defined twice?

Copy link
Contributor Author

@ajm188 ajm188 Jun 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still unsure how to best convey this in usage strings, but pflag.StringSlice lets you do:

-x "a,b"        # result: [a, b]
-x "a" -x "b"   # result: [a, b]
-x "a,b" -x "c" # result: [a, b, c]

@ajm188 ajm188 merged commit 2a92dae into vitessio:master Jun 1, 2021
@ajm188 ajm188 deleted the am_cell_rw_rpcs branch June 1, 2021 20:14
ajm188 pushed a commit to tinyspeck/vitess that referenced this pull request Jul 23, 2021
[vtctldserver] Migrate `CellInfo`, `CellAlias` rw RPCs

Signed-off-by: Andrew Mason <amason@slack-corp.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add CellInfo and CellsAlias r/w rpcs to VtctldServer

2 participants