Skip to content

[vtctld] Migrate GetSrvKeyspace as GetSrvKeyspaces in VtctldServer#7680

Merged
deepthi merged 5 commits intovitessio:masterfrom
tinyspeck:am_vtctld_srvkeyspace
Mar 15, 2021
Merged

[vtctld] Migrate GetSrvKeyspace as GetSrvKeyspaces in VtctldServer#7680
deepthi merged 5 commits intovitessio:masterfrom
tinyspeck:am_vtctld_srvkeyspace

Conversation

@ajm188
Copy link
Contributor

@ajm188 ajm188 commented Mar 14, 2021

Description

This PR migrates the GetSrvKeyspace command and rpc to the newer VtctldServer, renamed as GetSrvKeyspaces. Changes:

  • Support multiple cells at once.
  • Return a mapping of cell => srvkeyspace, rather than a single srvkeyspace
  • Support specifying no cells at all, in which case we look up all cells in the topo on behalf of the caller and return a full mapping.

Related Issue(s)

Checklist

  • Should this PR be backported? No
  • Tests were added or are not required
  • Documentation was added or is not required

Deployment Notes

Example usage:
❯ vtctldclient --server "localhost:15999" GetSrvKeyspaces commerce zone1
{
  "zone1": {
    "partitions": [
      {
        "served_type": 1,
        "shard_references": [
          {
            "name": "0"
          }
        ]
      },
      {
        "served_type": 2,
        "shard_references": [
          {
            "name": "0"
          }
        ]
      },
      {
        "served_type": 3,
        "shard_references": [
          {
            "name": "0"
          }
        ]
      }
    ]
  }
}
❯ vtctldclient --server "localhost:15999" GetSrvKeyspaces commerce zone2
{
  "zone2": null
}
❯ vtctldclient --server "localhost:15999" GetSrvKeyspaces commerce
{
  "zone1": {
    "partitions": [
      {
        "served_type": 1,
        "shard_references": [
          {
            "name": "0"
          }
        ]
      },
      {
        "served_type": 2,
        "shard_references": [
          {
            "name": "0"
          }
        ]
      },
      {
        "served_type": 3,
        "shard_references": [
          {
            "name": "0"
          }
        ]
      }
    ]
  }
}
❯ vtctldclient --server "localhost:15999" GetSrvKeyspaces -h
Usage:
   GetSrvKeyspaces <keyspace> [<cell> ...] [flags]

Flags:
  -h, --help   help for GetSrvKeyspaces

Global Flags:

Impacted Areas in Vitess

Components that this PR will affect:

  • Query Serving
  • VReplication
  • Cluster Management
  • Build/CI
  • VTAdmin

Andrew Mason added 4 commits March 14, 2021 11:35
Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
…Schema there

Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
Copy link
Contributor

@doeg doeg left a comment

Choose a reason for hiding this comment

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

Thanks!!! 🌻

Signed-off-by: Andrew Mason <amason@slack-corp.com>
@ajm188
Copy link
Contributor Author

ajm188 commented Mar 14, 2021

Latest commit reimplementing the legacy command using the new implementation:

Before
❯ vtctlclient -server "localhost:15999" GetSrvKeyspace zone1 commerce
{
  "partitions": [
    {
      "served_type": 1,
      "shard_references": [
        {
          "name": "0",
          "key_range": null
        }
      ],
      "shard_tablet_controls": [
      ]
    },
    {
      "served_type": 2,
      "shard_references": [
        {
          "name": "0",
          "key_range": null
        }
      ],
      "shard_tablet_controls": [
      ]
    },
    {
      "served_type": 3,
      "shard_references": [
        {
          "name": "0",
          "key_range": null
        }
      ],
      "shard_tablet_controls": [
      ]
    }
  ],
  "sharding_column_name": "",
  "sharding_column_type": 0,
  "served_from": [
  ]
}
After
❯ vtctlclient -server "localhost:15999" GetSrvKeyspace zone1 commerce
{
  "partitions": [
    {
      "served_type": 1,
      "shard_references": [
        {
          "name": "0",
          "key_range": null
        }
      ],
      "shard_tablet_controls": [
      ]
    },
    {
      "served_type": 2,
      "shard_references": [
        {
          "name": "0",
          "key_range": null
        }
      ],
      "shard_tablet_controls": [
      ]
    },
    {
      "served_type": 3,
      "shard_references": [
        {
          "name": "0",
          "key_range": null
        }
      ],
      "shard_tablet_controls": [
      ]
    }
  ],
  "sharding_column_name": "",
  "sharding_column_type": 0,
  "served_from": [
  ]
}

Copy link
Contributor

@doeg doeg left a comment

Choose a reason for hiding this comment

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

Love to reimplement a legacy command using a new implementation. Still looks good to me!

@deepthi @rohit-nayak-ps would you mind looking at this one too, when you get a chance? :D

Copy link
Collaborator

@deepthi deepthi left a comment

Choose a reason for hiding this comment

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

Nice work! You always do such a nice job with comments and unit tests 💯

@deepthi deepthi merged commit 8329bb3 into vitessio:master Mar 15, 2021
@ajm188 ajm188 deleted the am_vtctld_srvkeyspace branch March 16, 2021 00:03
@askdba askdba added this to the v10.0 milestone Mar 18, 2021
rafael pushed a commit to tinyspeck/vitess that referenced this pull request Apr 6, 2021
[vtctld] Migrate GetSrvKeyspace as GetSrvKeyspaces in VtctldServer

Signed-off-by: Rafael Chacon <rafael@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.

Migrate GetSrvKeyspace to VtctldServer

4 participants