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

Support specifying expected primary in ERS/PRS #16852

Merged
merged 15 commits into from
Oct 4, 2024

Conversation

timvaillancourt
Copy link
Contributor

@timvaillancourt timvaillancourt commented Sep 26, 2024

Description

This PR allows a EmergencyReparentShard/PlannedReparentShard request to contain the alias of the primary we expect to be the current primary for the action to succeed. If this alias is incorrect or stale, the reparent fails with an error indicating there is a failed precondition/mismatch.

This is useful to prevent races between external automation that runs reparents and Vitess (vtorc and vtctld), which may reparent a shard in the time external automation is creating/processing it's own reparent request. With this support added, automation with a stale view of the world will encounter an error instead of triggering an potentially unnecessary reparent

In the future, Vitess could use this field internally to be more explicit but because everything uses shard locks, it should never encounter a mismatch

Related Issue(s)

Resolves #16430

Checklist

  • "Backport to:" labels have been added if this change should be back-ported to release branches
  • If this change is to be back-ported to previous releases, a justification is included in the PR description
  • Tests were added or are not required
  • Did the new or modified tests pass consistently locally and on CI?
  • Documentation was added or is not required

Deployment Notes

Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[email protected]>
Copy link
Contributor

vitess-bot bot commented Sep 26, 2024

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has a descriptive title.
  • Ensure there is a link to an issue (except for internal cleanup and flaky test fixes), new features should have an RFC that documents use cases and test cases.

Tests

  • Bug fixes should have at least one unit or end-to-end test, enhancement and new features should have a sufficient number of tests.

Documentation

  • Apply the release notes (needs details) label if users need to know about this change.
  • New features should be documented.
  • There should be some code comments as to why things are implemented the way they are.
  • There should be a comment at the top of each new or modified test to explain what the test does.

New flags

  • Is this flag really necessary?
  • Flag names must be clear and intuitive, use dashes (-), and have a clear help text.

If a workflow is added or modified:

  • Each item in Jobs should be named in order to mark it as required.
  • If the workflow needs to be marked as required, the maintainer team must be notified.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • RPC changes should be compatible with vitess-operator
  • If a flag is removed, then it should also be removed from vitess-operator and arewefastyet, if used there.
  • vtctl command output order should be stable and awk-able.

@vitess-bot vitess-bot bot added NeedsBackportReason If backport labels have been applied to a PR, a justification is required NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsIssue A linked issue is missing for this Pull Request NeedsWebsiteDocsUpdate What it says labels Sep 26, 2024
@timvaillancourt timvaillancourt added Type: Enhancement Logical improvement (somewhere between a bug and feature) Component: vtctl and removed NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsWebsiteDocsUpdate What it says NeedsIssue A linked issue is missing for this Pull Request NeedsBackportReason If backport labels have been applied to a PR, a justification is required labels Sep 26, 2024
@timvaillancourt timvaillancourt changed the title Support specifying expected primary in ERS Support specifying expected primary in ERS/PRS Oct 2, 2024
Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[email protected]>
@timvaillancourt
Copy link
Contributor Author

timvaillancourt commented Oct 2, 2024

I think I prefer the field-name RequiredPrimary now but let's vote on it

🎉 for ExpectedPrimary
🚀 for RequiredPrimary
👀 for ExpectedCurrentPrimary
😄 for RequiredCurrentPrimary

Or other suggestions appreciated

Signed-off-by: Tim Vaillancourt <[email protected]>
Copy link
Member

@GuptaManan100 GuptaManan100 left a comment

Choose a reason for hiding this comment

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

LGTM!

@deepthi
Copy link
Member

deepthi commented Oct 3, 2024

I think I prefer the field-name RequiredPrimary now but let's vote on it

🎉 for ExpectedPrimary 🚀 for RequiredPrimary

Or other suggestions appreciated

RequiredCurrentPrimary OR ExpectedCurrentPrimary :)

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.

LGTM. Once the flag name is final, you should edit the PR description to document command usage. I've added a label that prevents merge, and you can remove the label and merge it at that point.

@deepthi deepthi added the NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work label Oct 3, 2024
@timvaillancourt
Copy link
Contributor Author

LGTM. Once the flag name is final, you should edit the PR description to document command usage. I've added a label that prevents merge, and you can remove the label and merge it at that point.

Sounds good! It looks like there weren't many strong opinions on naming

I think I've flip/flopped back to leaving this as-is. My reasoning is if I say what I'm asking to do out loud it is "do X reparent and I expect Y to be still be the primary". And I feel adding Current is redundant because there can only be a single primary

@timvaillancourt timvaillancourt removed the NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work label Oct 4, 2024
@timvaillancourt timvaillancourt merged commit 945124a into vitessio:main Oct 4, 2024
102 of 103 checks passed
@timvaillancourt timvaillancourt deleted the ers-current-primary branch October 4, 2024 12:58
timvaillancourt added a commit to slackhq/vitess that referenced this pull request Oct 9, 2024
timvaillancourt added a commit to slackhq/vitess that referenced this pull request Oct 9, 2024
Signed-off-by: Tim Vaillancourt <[email protected]>
timvaillancourt added a commit to timvaillancourt/vitess that referenced this pull request Oct 9, 2024
Signed-off-by: Tim Vaillancourt <[email protected]>
rohit-nayak-ps pushed a commit that referenced this pull request Oct 10, 2024
Signed-off-by: Tim Vaillancourt <[email protected]>
vitess-bot pushed a commit that referenced this pull request Oct 10, 2024
timvaillancourt added a commit to slackhq/vitess that referenced this pull request Oct 10, 2024
* `slack-15.0`: backport PR vitessio#16852

Signed-off-by: Tim Vaillancourt <[email protected]>

* make vtadmin_web_proto_types

Signed-off-by: Tim Vaillancourt <[email protected]>

* fix v15 tests

Signed-off-by: Tim Vaillancourt <[email protected]>

---------

Signed-off-by: Tim Vaillancourt <[email protected]>
timvaillancourt added a commit to slackhq/vitess that referenced this pull request Oct 10, 2024
* Support specifying expected primary in ERS/PRS (vitessio#16852)

Signed-off-by: Tim Vaillancourt <[email protected]>

* fix typo

Signed-off-by: Tim Vaillancourt <[email protected]>

---------

Signed-off-by: Tim Vaillancourt <[email protected]>
rohit-nayak-ps pushed a commit that referenced this pull request Oct 13, 2024
Signed-off-by: Tim Vaillancourt <[email protected]>
Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com>
timvaillancourt added a commit to timvaillancourt/vitess that referenced this pull request Oct 18, 2024
frouioui pushed a commit that referenced this pull request Oct 18, 2024
vitess-bot pushed a commit that referenced this pull request Oct 18, 2024
rohit-nayak-ps pushed a commit that referenced this pull request Oct 18, 2024
Signed-off-by: Tim Vaillancourt <[email protected]>
Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: CLI Component: vtctl Type: Enhancement Logical improvement (somewhere between a bug and feature)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: allow current/before PRIMARY to be specified in ERS
5 participants