Skip to content
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 CellInfo, CellAlias rw RPCs #8219

Merged
merged 4 commits into from
Jun 1, 2021

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

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>
}
// 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
Vtctld Service automation moved this from In progress to Done Jun 1, 2021
@ajm188 ajm188 deleted the am_cell_rw_rpcs branch June 1, 2021 20:14
ajm188 added 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
Development

Successfully merging this pull request may close these issues.

Add CellInfo and CellsAlias r/w rpcs to VtctldServer
2 participants