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

[vtctl] command deprecations #8967

Merged
merged 2 commits into from
Oct 15, 2021
Merged

Conversation

ajm188
Copy link
Contributor

@ajm188 ajm188 commented Oct 9, 2021

Description

This PR adds fields to the command struct to support more formalized deprecation of commands. Unfortunately this required me to update every single command, because we weren't using keyed structs, but that is now fixed as well.

Examples:

I1008 18:54:55.783596   28685 main.go:67] I1008 22:54:55.782820 tablet_executor.go:277] Received DDL request. strategy=direct
I1008 18:54:56.177633   28685 main.go:67] I1008 22:54:56.177359 tablet_executor.go:277] Received DDL request. strategy=direct
I1008 18:54:56.784269   28685 main.go:67] I1008 22:54:56.784065 tablet_executor.go:277] Received DDL request. strategy=direct
New VSchema object:
{
  "tables": {
    "corder": {},
    "customer": {},
    "product": {}
  }
}
If this is not what you expected, check the input data (as JSON parsing will skip unexpected fields).
Waiting for vtgate to be up...
vtgate is up!
Access vtgate at http://SFO-M-AMASON02:15001/debug/status
❯ vtctlclient -server ":15999" help | grep DEPR
  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>
  (DEPRECATED) UpdateTabletAddrs [-hostname <hostname>] [-ip-addr <ip addr>] [-mysql-port <mysql port>] [-vt-port <vt port>] [-grpc-port <grpc port>] <tablet alias> 
  (DEPRECATED) SetShardIsMasterServing <keyspace/shard> <is_master_serving>
  (DEPRECATED) InitShardMaster [-force] [-wait_replicas_timeout=<duration>] <keyspace/shard> <tablet alias>
  CreateLookupVindex [-cell=<source_cells> DEPRECATED] [-cells=<source_cells>] [-tablet_types=<source_tablet_types>] <keyspace> <json_spec>
  (DEPRECATED) SplitClone <keyspace> <from_shards> <to_shards>
  (DEPRECATED) VerticalSplitClone <from_keyspace> <to_keyspace> <tables>
❯ vtctlclient -server ":15999" InitShardMaster -h
WARNING: InitShardMaster is deprecated and will be removed in a future release. Use InitShardPrimary instead.
Usage: InitShardMaster [-force] [-wait_replicas_timeout=<duration>] <keyspace/shard> <tablet alias>

DEPRECATED. Use InitShardPrimary instead.

  -force
        will force the reparent even if the provided tablet is not writable or the shard primary
  -wait_replicas_timeout duration
        time to wait for replicas to catch up in reparenting (default 30s)
❯ ./401_teardown.sh
Stopping vtgate...
Shutting down tablet zone1-100
Shutting down mysql zone1-100
Shutting down tablet zone1-101
Shutting down mysql zone1-101
Shutting down tablet zone1-102
Shutting down mysql zone1-102
Stopping vtctld...
Stopping etcd...
All good! It looks like every process has shut down

Related Issue(s)

Fixes #8953.

Checklist

  • Should this PR be backported? no
  • Tests were added or are not required n/a
  • Documentation was added or is not required

Deployment Notes

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.

The end-result is so readable!

go/vt/vtctl/vtctl.go Outdated Show resolved Hide resolved
Copy link
Member

@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.

This is great!
Approving pre-emptively, I do think @doeg's comment needs to be addressed before we merge this.
Can you think of a reason why we should not port this to 12.0 before releasing it?

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

ajm188 commented Oct 12, 2021

I do think @doeg's comment needs to be addressed before we merge this.

Agreed, and done.

Can you think of a reason why we should not port this to 12.0 before releasing it?

Nope, I will port it over there as well!

Signed-off-by: Andrew Mason <amason@slack-corp.com>
@ajm188 ajm188 merged commit ffe3574 into vitessio:main Oct 15, 2021
@ajm188 ajm188 deleted the vtctl-command-deprecations branch October 15, 2021 14:19
ajm188 added a commit to ajm188/vitess that referenced this pull request Oct 15, 2021
[vtctl] command deprecations

Signed-off-by: Andrew Mason <amason@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.

Deprecated vtctl commands should print a deprecation notice
3 participants