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

Fix vtctlclient help #7147

Closed
deepthi opened this issue Dec 9, 2020 · 7 comments
Closed

Fix vtctlclient help #7147

deepthi opened this issue Dec 9, 2020 · 7 comments

Comments

@deepthi
Copy link
Member

deepthi commented Dec 9, 2020

Right now vtctlclient --help will list a bunch of flags.
Snippet:

$ vtctlclient --help
Usage of vtctlclient:
  -action_timeout duration
    	timeout for the total command (default 1h0m0s)
  -alsologtostderr
    	log to standard error as well as files

What we would like it to do is to return the list of valid commands after the list of flags similar to how vtctl --help works.

The commands are listed below, sorted by group. Use 'vtctl <command> -h' for more help.

Tablets:
  InitTablet DEPRECATED [-allow_update] [-allow_different_shard] [-allow_master_override] [-parent] [-db_name_override=<db name>] [-hostname=<hostname>] [-mysql_port=<port>] [-port=<port>] [-grpc_port=<port>] [-tags=tag1:value1,tag2:value2] -keyspace=<keyspace> -shard=<shard> <tablet alias> <tablet type>
  GetTablet <tablet alias>

While we are at it, we should also:

  • Send output to stdout instead of stderr
  • Remove any flags that are not actually used by vtctlclient
@deepthi
Copy link
Member Author

deepthi commented Dec 9, 2020

Since we are planning to deprecate vtctlclient once #7058 is available, we could make sure to capture this in vtctldclient instead.
cc @ajm188

@ajm188
Copy link
Contributor

ajm188 commented Dec 9, 2020

Yeah, because the new client uses cobra we actually get this for free, e.g.

❯ ./bin/vtctldclient --help
Usage:
   [command]

Available Commands:
  GetKeyspace  
  GetKeyspaces 
  help         Help about any command

Flags:
      --action_timeout duration                timeout for the total command (default 1h0m0s)
      --alsologtostderr                        log to standard error as well as files
      --datadog-agent-host string              host to send spans to. if empty, no tracing will be done
      --datadog-agent-port string              port to send spans to. if empty, no tracing will be done
      ... [more flags]

I'll have to think about how to best filter out the default servenv flags from the help, but we're already halfway there 😄

@deepthi
Copy link
Member Author

deepthi commented Feb 21, 2023

Since vtctlclient will be deprecated once vtctldclient reaches parity, this issue is no longer needed.

@deepthi deepthi closed this as completed Feb 21, 2023
@ajm188
Copy link
Contributor

ajm188 commented Feb 22, 2023

(fwiw i also think this was resolved by the flag work)

@Anders-PlanetScale
Copy link
Collaborator

For future posterity. while vtctlclient --help does not display the list of commands available it looks like in v15 at least vtctlclient --server=X help does work. Example below with truncated output.

vtctlclient --server=localhost:15999 help
Available commands: 
Tablets:
  (DEPRECATED) InitTablet [--allow_update] [--allow_different_shard] [--allow_master_override] [--parent] [--db_name_override=<db name>] [--hostname=<hostname>] [--mysql_port=<port>] [--port=<port>] [--grpc_port=<port>] [--tags=tag1:value1,tag2:value2] --keyspace=<keyspace> --shard=<shard> <tablet alias> <tablet type>
  GetTablet <tablet alias>
  (DEPRECATED) UpdateTabletAddrs [--hostname <hostname>] [--ip-addr <ip addr>] [--mysql-port <mysql port>] [--vt-port <vt port>] [--grpc-port <grpc port>] <tablet alias> 
  DeleteTablet [--allow_primary] <tablet alias> ...
  SetReadOnly <tablet alias>

...

@deepthi
Copy link
Member Author

deepthi commented Feb 23, 2023

(fwiw i also think this was resolved by the flag work)

not really. --help still prints only flags, except it now has the same behavior for vtctl as well as vtctlclient 😭

@deepthi
Copy link
Member Author

deepthi commented Feb 23, 2023

Nice find @Anders-PlanetScale!
Inspired by that, I found out this works as well

$ vtctl --topo_implementation etcd2 --topo_global_root /vitess/global --topo_global_server_address localhost:2379 help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants