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

[vtadmin-api] Update GetTablet to use alias instead of hostname #8163

Merged
merged 1 commit into from
May 20, 2021

Conversation

doeg
Copy link
Contributor

@doeg doeg commented May 20, 2021

Signed-off-by: Sara Bee 855595+doeg@users.noreply.github.com

Description

Since tablet hostnames alone aren't guaranteed to be unique even in the same cluster (as with the local example), this updates the /api/tablet/{tablet} and /experimental/tablet/{tablet}/debug/vars endpoints to use tablet alias as an identifier instead.

No changes required to vtadmin-web for this; it doesn't use these endpoints yet.

An example:

$ curl "http://localhost:14200/api/tablet/zone1-102" | jq .
{
  "result": {
    "cluster": {
      "id": "id1",
      "name": "cluster1"
    },
    "tablet": {
      "alias": {
        "cell": "zone1",
        "uid": 102
      },
      "hostname": "a4c88ebf1fe6",
      "keyspace": "commerce",
      "shard": "0",
      "type": 3
    },
    "state": 1
  },
  "ok": true
}

...and an example of an error when an invalid alias is given (which the existing tests already cover):

$ curl "http://localhost:14200/api/tablet/does-not-exist" | jq .
{
  "error": {
    "message": "failed to parse tablet_alias does-not-exist: invalid tablet alias: 'does-not-exist', expecting format: '<cell>-<uid>'",
    "code": "unknown"
  },
  "ok": false
}

Related Issue(s)

N/A

Checklist

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

Deployment Notes

N/A

Signed-off-by: Sara Bee <855595+doeg@users.noreply.github.com>
@doeg doeg requested review from rafael and ajm188 May 20, 2021 18:30
@doeg doeg added this to In progress in VTAdmin via automation May 20, 2021
@doeg doeg requested a review from rohit-nayak-ps as a code owner May 20, 2021 18:30
@systay systay added Component: VTAdmin VTadmin interface Type: Enhancement Logical improvement (somewhere between a bug and feature) labels May 20, 2021
Copy link
Member

@rafael rafael left a comment

Choose a reason for hiding this comment

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

Makes sense to me. LGTM

@ajm188 ajm188 merged commit 3f8ca0a into vitessio:master May 20, 2021
VTAdmin automation moved this from In progress to Done May 20, 2021
@ajm188 ajm188 deleted the sarabee-vtadmin-tablet-aliases branch May 20, 2021 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: VTAdmin VTadmin interface Type: Enhancement Logical improvement (somewhere between a bug and feature)
Projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants