[vtadmin] Add GetSchema endpoint#7596
Conversation
Signed-off-by: Andrew Mason <amason@slack-corp.com>
…o use it, implement (*vtadmin.API).GetSchema 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>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
doeg
left a comment
There was a problem hiding this comment.
Thanks so much for doing this + additionally for remembering to generate the TypeScript types ❤️
Looks great as always, obviously -- just one tiny comment that you can probably ignore at this point!
| router.HandleFunc("/clusters", httpAPI.Adapt(vtadminhttp.GetClusters)).Name("API.GetClusters") | ||
| router.HandleFunc("/gates", httpAPI.Adapt(vtadminhttp.GetGates)).Name("API.GetGates") | ||
| router.HandleFunc("/keyspaces", httpAPI.Adapt(vtadminhttp.GetKeyspaces)).Name("API.GetKeyspaces") | ||
| router.HandleFunc("/schema/{cluster_id}/{keyspace}/{table}", httpAPI.Adapt(vtadminhttp.GetSchema)).Name("API.GetSchema") |
There was a problem hiding this comment.
What do you think about making this /schema?cluster_id=&keyspace=&table=? I honestly think the way you have it now is prettier, but:
- It would also work for disambiguation (where cluster/keyspace are optinoal)
- We already do this for the
/tabletendpoint (which has an optional cluster parameter too)
There was a problem hiding this comment.
I realize you started the disambiguation branch anyway so I expect you already have some plan 😎
There was a problem hiding this comment.
I think, given that you said this route scheme looks prettier, that we should keep it as-is because:
- we're still able to reuse the logic of
cluster.GetSchemabetween the two endpoints, so we're not duplicating too much - having two distinct rpcs and http routes lets us move some of the conditional logic out of the actual function and into the route definition (i.e.
GetSchemadoesn't have to thatlen(clusterIds)is exactly 1, because it's not possible, but if we combine it with theFindSchemaendpoint then we'll end up introducing a bunch of "if this then do thingAForGetSchema else do thingBForFindSchema" branching)
There was a problem hiding this comment.
The /schema endpoint does seem a bit non-std instead of url params or nested resource paths like /schema/cluster/{cluster_id}/keyspace/{keyspace}/table/{table}. But it is more succinct and we can revisit this once we have all our endpoints in place.
Description
This adds a GetSchema rpc to the vtadmin service, and an http wrapper at
/api/schema/{cluster_id}/{keyspace}/{table}Related Issue(s)
Checklist
Deployment Notes
Impacted Areas in Vitess
Components that this PR will affect: