-
Notifications
You must be signed in to change notification settings - Fork 2.4k
ApplySchema: deprecate '--allow_long_unavailability' flag #10717
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
Changes from 7 commits
6f57d7b
4929201
9010723
08d07dc
d9c4598
e72d14d
b44829f
436c9fc
213c671
18da45f
d52f24b
c1628e0
3e2f944
6832693
9434bb3
557a336
0212ae3
d3b7706
1d8e373
7e6cc03
47f4312
e22e6dc
3954302
d7277b8
4831f76
24438e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -138,7 +138,7 @@ func commandApplySchema(cmd *cobra.Command, args []string) error { | |
|
|
||
| resp, err := client.ApplySchema(commandCtx, &vtctldatapb.ApplySchemaRequest{ | ||
| Keyspace: ks, | ||
| AllowLongUnavailability: applySchemaOptions.AllowLongUnavailability, | ||
| AllowLongUnavailability: false, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this still exists in the Further, here, you can add a line to deprecate the flag (docs reference) via: ApplySchema.Flags().MarkDeprecated("--allow-long-unavailability", "<deprecation text goes here>")
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oooh! Didn't know that
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've made the changes; but I'm left wondering why we have two different places where we define this flag? The other place being
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One is the old vtctlclient command interface and the other is the new vtctldclient interface.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This brings up another point. We should deprecate the proto field as well (using the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case, the flag used to default to false, so deprecating the proto field will be fine (which is not the case in #10716) |
||
| DdlStrategy: applySchemaOptions.DDLStrategy, | ||
| Sql: parts, | ||
| SkipPreflight: applySchemaOptions.SkipPreflight, | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -611,8 +611,8 @@ var commands = []commandGroup{ | |||||
| { | ||||||
| name: "ApplySchema", | ||||||
| method: commandApplySchema, | ||||||
| params: "[--allow_long_unavailability] [--wait_replicas_timeout=10s] [--ddl_strategy=<ddl_strategy>] [--uuid_list=<comma_separated_uuids>] [--migration_context=<unique-request-context>] [--skip_preflight] {--sql=<sql> || --sql-file=<filename>} <keyspace>", | ||||||
| help: "Applies the schema change to the specified keyspace on every primary, running in parallel on all shards. The changes are then propagated to replicas via replication. If --allow_long_unavailability is set, schema changes affecting a large number of rows (and possibly incurring a longer period of unavailability) will not be rejected. -ddl_strategy is used to instruct migrations via vreplication, gh-ost or pt-osc with optional parameters. -migration_context allows the user to specify a custom request context for online DDL migrations. If -skip_preflight, SQL goes directly to shards without going through sanity checks.", | ||||||
| params: "[--wait_replicas_timeout=10s] [--ddl_strategy=<ddl_strategy>] [--uuid_list=<comma_separated_uuids>] [--migration_context=<unique-request-context>] [--skip_preflight] {--sql=<sql> || --sql-file=<filename>} <keyspace>", | ||||||
| help: "Applies the schema change to the specified keyspace on every primary, running in parallel on all shards. The changes are then propagated to replicas via replication. -ddl_strategy is used to instruct migrations via vreplication, gh-ost or pt-osc with optional parameters. -migration_context allows the user to specify a custom request context for online DDL migrations. If -skip_preflight, SQL goes directly to shards without going through sanity checks.", | ||||||
| }, | ||||||
| { | ||||||
| name: "CopySchemaShard", | ||||||
|
|
@@ -3053,7 +3053,7 @@ func commandValidateSchemaKeyspace(ctx context.Context, wr *wrangler.Wrangler, s | |||||
| } | ||||||
|
|
||||||
| func commandApplySchema(ctx context.Context, wr *wrangler.Wrangler, subFlags *flag.FlagSet, args []string) error { | ||||||
| allowLongUnavailability := subFlags.Bool("allow_long_unavailability", false, "Allow large schema changes which incur a longer unavailability of the database.") | ||||||
| allowLongUnavailability := subFlags.Bool("allow_long_unavailability", false, "Deprecated. We recommend using Online DDL for schema changes, big or small.") | ||||||
|
mattlord marked this conversation as resolved.
Outdated
|
||||||
| sql := subFlags.String("sql", "", "A list of semicolon-delimited SQL commands") | ||||||
| sqlFile := subFlags.String("sql-file", "", "Identifies the file that contains the SQL commands") | ||||||
| ddlStrategy := subFlags.String("ddl_strategy", string(schema.DDLStrategyDirect), "Online DDL strategy, compatible with @@ddl_strategy session variable (examples: 'gh-ost', 'pt-osc', 'gh-ost --max-load=Threads_running=100'") | ||||||
|
|
@@ -3070,6 +3070,9 @@ func commandApplySchema(ctx context.Context, wr *wrangler.Wrangler, subFlags *fl | |||||
| if subFlags.NArg() != 1 { | ||||||
| return fmt.Errorf("the <keyspace> argument is required for the commandApplySchema command") | ||||||
| } | ||||||
| if *allowLongUnavailability { | ||||||
| log.Warningf("--allow_long_unavailability flag is deprecated. We recomment using Online DDL for schema changes, big or small.") | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||||||
| } | ||||||
|
|
||||||
| // v14 deprecates `--skip-topo` flag. This check will be removed in v15 | ||||||
| if settings, _ := schema.ParseDDLStrategy(*ddlStrategy); settings != nil && settings.IsSkipTopoFlag() { | ||||||
|
|
@@ -3104,7 +3107,7 @@ func commandApplySchema(ctx context.Context, wr *wrangler.Wrangler, subFlags *fl | |||||
|
|
||||||
| resp, err := wr.VtctldServer().ApplySchema(ctx, &vtctldatapb.ApplySchemaRequest{ | ||||||
| Keyspace: keyspace, | ||||||
| AllowLongUnavailability: *allowLongUnavailability, | ||||||
| AllowLongUnavailability: false, | ||||||
| DdlStrategy: *ddlStrategy, | ||||||
| Sql: parts, | ||||||
| SkipPreflight: *skipPreflight, | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.
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.
Are we deprecating it or removing it? The title says deprecate but this is effectively removal isn't it, since any value provided by the user will be ignored. No?
Or maybe it's simply no longer needed so we're keeping the flag around and marking it as deprecated so that it gives users a release to remove the flag in their scripts etc? I will assume that is the case (the description also seems to be saying this).
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.
That's the one. We remove the functionality, but keep the flag so that
vttabletexecution does not break yet.