Skip to content

Online DDL: introducing ddl_strategy -singleton-context flag#7946

Merged
shlomi-noach merged 11 commits intovitessio:masterfrom
planetscale:online-ddl-singleton-context-flag
Apr 26, 2021
Merged

Online DDL: introducing ddl_strategy -singleton-context flag#7946
shlomi-noach merged 11 commits intovitessio:masterfrom
planetscale:online-ddl-singleton-context-flag

Conversation

@shlomi-noach
Copy link
Contributor

@shlomi-noach shlomi-noach commented Apr 25, 2021

Description

Followup to #7785

This PR introduces ddl_strategy now supports -singleton-context flag.

  • -singleton rejects a migration if there's any other pending migration
  • -singleton-context rejects a migration is there's any other pending migration that has a different migration context.
    With -singleton-context, it is possible to submit multiple migrations which all share the same migration context. For example, the following is allowed:
vtctlclient ApplySchema -ddl_strategy="online -singleton-context" -sql "drop table if exists t1; drop table if exists t2; drop table if exists t3;" commerce

The above submits three migrations. All three will be accepted. For comparison, running the above with -singleton would accept the first migration (drop table if exists t1) and reject the other two.

Related Issue(s)

Checklist

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

Deployment Notes

Impacted Areas in Vitess

Components that this PR will affect:

  • Query Serving
  • VReplication
  • Cluster Management
  • Build/CI
  • VTAdmin

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
@shlomi-noach
Copy link
Contributor Author

tests added and looking good.

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
@shlomi-noach shlomi-noach requested a review from a team April 26, 2021 04:48
case onlineDDL.StrategySetting().IsSingleton():
// We will reject this migration if there's any pending migration
if len(pendingUUIDs) > 0 {
return result, fmt.Errorf("singleton migration rejected: found pending migrations [%s]", strings.Join(pendingUUIDs, ", "))
Copy link
Collaborator

@systay systay Apr 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vterrors should be used, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right 😛

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Collaborator

@systay systay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
@shlomi-noach shlomi-noach merged commit b1f9000 into vitessio:master Apr 26, 2021
@shlomi-noach shlomi-noach deleted the online-ddl-singleton-context-flag branch April 26, 2021 06:01
@systay systay added Component: Query Serving Type: Enhancement Logical improvement (somewhere between a bug and feature) labels Apr 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: Query Serving Type: Enhancement Logical improvement (somewhere between a bug and feature)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants