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

Relax singleton-context constraint for pending non-singleton-context reverts #10114

Conversation

shlomi-noach
Copy link
Contributor

@shlomi-noach shlomi-noach commented Apr 20, 2022

Description

When a migration runs with -singleton-context ddl strategy flag, and with context A, then another migration with -singleton-context can only be submitted if it has same context A, and cannot be submitted if it has context B. Note, the submission itself returns with an error.

We want to have better user experience when it comes to reverts. Reverts may be long running and are allowed to run concurrently to other migrations.

A REVERT can run without a -singleton-context flag. In fact, this is the canonical way of running it. So we do not fail submitting a REVERT even if there are pending migrations.

However, what happens when a REVERT is already running, and a new migration comes in?

Starting this PR, the following holds true:

  • If a REVERT is running
  • And it does not have -singleton-context
  • Then a new migration can be submitted, even if it does have -singleton-context and with some arbitrary migration_context.

To clarify:

  • If a REVERT is running
  • And has a -singleton-context flag with some -migration_context=A
  • Then a new migration that has a -singleton-context flag may only be submitted it it also has -migration_context=A, and it will be rejected if it has -migration_context=B

The reason we add this relaxation is that we see an operational pattern in usage, and this behavior makes sense operationally.

Documentation to follow.

Related Issue(s)

Checklist

  • "Backport me!" label has been added if this change should be backported
  • Tests were added or are not required
  • Documentation was added or is not required

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 shlomi-noach added Type: Enhancement Logical improvement (somewhere between a bug and feature) Component: Query Serving release notes labels Apr 20, 2022
@shlomi-noach shlomi-noach requested a review from a team April 20, 2022 06:34
@shlomi-noach
Copy link
Contributor Author

Call for review

Copy link
Contributor

@mattlord mattlord left a comment

Choose a reason for hiding this comment

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

A couple of nits, but otherwise LGTM. We should at least change the single dashes to double for the new flag everywhere. Let me know what you think.

doc/releasenotes/14_0_0_summary.md Outdated Show resolved Hide resolved
Comment on lines 3597 to 3598
revertedUUID, _ := pendingOnlineDDL.GetRevertUUID()
if revertedUUID == "" {
Copy link
Contributor

@mattlord mattlord May 2, 2022

Choose a reason for hiding this comment

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

This feels like an opportunity for undefined behavior in the future. Any reason not to do this instead?

if _, err := pendingOnlineDDL.GetRevertUUID(); errors.Is(err, vtrpcpb.Code_INVALID_ARGUMENT) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed to if _, err := pendingOnlineDDL.GetRevertUUID(); err != nil ; I prefer not to rely on a specific error code.

go/vt/vttablet/onlineddl/executor.go Outdated Show resolved Hide resolved
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>
Copy link
Contributor

@mattlord mattlord left a comment

Choose a reason for hiding this comment

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

Thanks!

@shlomi-noach
Copy link
Contributor Author

no no, thank you

@shlomi-noach shlomi-noach merged commit bb2230e into vitessio:main May 3, 2022
@shlomi-noach shlomi-noach deleted the singleton-context-allow-reverts-without-single-context branch May 3, 2022 08:01
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.

None yet

2 participants