-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[vtctld] Fix accidentally-broken legacy vtctl output format #7285
[vtctld] Fix accidentally-broken legacy vtctl output format #7285
Conversation
Signed-off-by: Andrew Mason <[email protected]>
+1 with the acknowledgement of :
Let me know if I can help with that! 🌻 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth calling out that this was confirmed by observing that the fixed output still works with our tooling that expects the old format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as well. Merging this as is.
One follow up question: are there other places were this code change could have introduced a similar regression? I didn't look in the detail the previous change where the regression was originally introduced.
Here's the entire diff to vtctl.go that I've made over the 3 PRs. Everything else has been additive to the new interface instead: diff --git a/go/vt/vtctl/vtctl.go b/go/vt/vtctl/vtctl.go
index 97b7ac8513..e33d20e082 100644
--- a/go/vt/vtctl/vtctl.go
+++ b/go/vt/vtctl/vtctl.go
@@ -1761,20 +1761,29 @@ func commandGetKeyspace(ctx context.Context, wr *wrangler.Wrangler, subFlags *fl
}
keyspace := subFlags.Arg(0)
- keyspaceInfo, err := wr.TopoServer().GetKeyspace(ctx, keyspace)
+
+ keyspaceInfo, err := wr.VtctldServer().GetKeyspace(ctx, &vtctldatapb.GetKeyspaceRequest{
+ Keyspace: keyspace,
+ })
if err != nil {
return err
}
// Pass the embedded proto directly or jsonpb will panic.
- return printJSON(wr.Logger(), keyspaceInfo.Keyspace)
+ return printJSON(wr.Logger(), keyspaceInfo.Keyspace.Keyspace)
}
func commandGetKeyspaces(ctx context.Context, wr *wrangler.Wrangler, subFlags *flag.FlagSet, args []string) error {
- keyspaces, err := wr.TopoServer().GetKeyspaces(ctx)
+ resp, err := wr.VtctldServer().GetKeyspaces(ctx, &vtctldatapb.GetKeyspacesRequest{})
if err != nil {
return err
}
- wr.Logger().Printf("%v\n", strings.Join(keyspaces, "\n"))
+
+ names := make([]string, len(resp.Keyspaces))
+ for i, ks := range resp.Keyspaces {
+ names[i] = ks.Name
+ }
+
+ wr.Logger().Printf("%v\n", strings.Join(names, "\n"))
return nil
}
@@ -2208,11 +2217,14 @@ func commandFindAllShardsInKeyspace(ctx context.Context, wr *wrangler.Wrangler,
}
keyspace := subFlags.Arg(0)
- result, err := wr.TopoServer().FindAllShardsInKeyspace(ctx, keyspace)
+ result, err := wr.VtctldServer().FindAllShardsInKeyspace(ctx, &vtctldatapb.FindAllShardsInKeyspaceRequest{
+ Keyspace: keyspace,
+ })
if err != nil {
return err
}
- return printJSON(wr.Logger(), result)
+
+ return printJSON(wr.Logger(), result.Shards)
}
func commandValidate(ctx context.Context, wr *wrangler.Wrangler, subFlags *flag.FlagSet, args []string) error { |
…nkeyspace [vtctld] Fix accidentally-broken legacy vtctl output format
@ajm188 can you please create a PR to fix this for the 9.0 release branch? |
Yep, I'll have one out tomorrow! |
…nkeyspace [vtctld] Fix accidentally-broken legacy vtctl output format Signed-off-by: Andrew Mason <[email protected]>
…nkeyspace [vtctld] Fix accidentally-broken legacy vtctl output format
This was a regression introduced in #7128.
Description
This restores the original json format of the old vtctl API, which I broke when trying to reimplement the old API in terms of the new. Example (using the local example): first the new, changed output, and then the old, correct output:
Related Issue(s)
Checklist
Deployment Notes
Impacted Areas in Vitess
Components that this PR will affect: