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

Atomic Transactions correctness with PRS, ERS and MySQL & Vttablet Restarts #16553

Merged
merged 37 commits into from
Aug 21, 2024

Conversation

GuptaManan100
Copy link
Member

@GuptaManan100 GuptaManan100 commented Aug 7, 2024

Description

This PR makes the code changes required to ensure that atomic transactions don't break their atomic guarantee in the face of disruptions like PlannedReparentShard, EmergencyReparentShard, and MySQL and Vttablet restarts.

A lot of the logic on how we redo the prepared transactions had to be reworked. This PR also adds the design docs for these changes so that they can referenced in the future too.

The testing strategy for ensuring these changes work as intended is 2-fold -

  1. Fuzzer testing to randomly run disuptions in the fuzzer we previously added, which still ensures in the end that all accepted writes must be atomic.
  2. Explicit stress testing, that leverages our ability to write debug-only code into the binaries that we use for testing. We explicitly make the CommitPrepared stall on one of the shards, and then run a disruption to ensure that that write still gets committed without any other write on the same row going through.

This PR also adds a new design doc explaining all the steps that are involved in guaranteeing that atomic transactions work well with each of the many disruptions

Related Issue(s)

Checklist

  • 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

…the same column with extra information

Signed-off-by: Manan Gupta <[email protected]>
… ers and mysql restarts secure

Signed-off-by: Manan Gupta <[email protected]>
Copy link
Contributor

vitess-bot bot commented Aug 7, 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 Aug 7, 2024
@GuptaManan100 GuptaManan100 marked this pull request as draft August 7, 2024 12:52
@github-actions github-actions bot added this to the v21.0.0 milestone Aug 7, 2024
Copy link

codecov bot commented Aug 14, 2024

Codecov Report

Attention: Patch coverage is 72.52747% with 25 lines in your changes missing coverage. Please review.

Project coverage is 68.88%. Comparing base (5cb66a1) to head (226933c).
Report is 1 commits behind head on main.

Files Patch % Lines
go/vt/vttablet/tabletserver/tx_engine.go 75.55% 11 Missing ⚠️
go/vt/vttablet/tabletmanager/rpc_actions.go 0.00% 5 Missing ⚠️
go/vt/vttablet/tabletmanager/tm_init.go 60.00% 4 Missing ⚠️
go/vt/vttablet/tabletmanager/rpc_replication.go 0.00% 3 Missing ⚠️
go/vt/vttablet/tabletserver/tabletserver.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #16553   +/-   ##
=======================================
  Coverage   68.87%   68.88%           
=======================================
  Files        1562     1562           
  Lines      200621   200673   +52     
=======================================
+ Hits       138183   138231   +48     
- Misses      62438    62442    +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@GuptaManan100 GuptaManan100 removed the NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work label Aug 14, 2024
@GuptaManan100 GuptaManan100 marked this pull request as ready for review August 14, 2024 14:15
Copy link
Member

@harshit-gangal harshit-gangal left a comment

Choose a reason for hiding this comment

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

Overall looking good.

@GuptaManan100 GuptaManan100 merged commit 471ab1a into vitessio:main Aug 21, 2024
129 checks passed
@GuptaManan100 GuptaManan100 deleted the fuzzer-disruptions branch August 21, 2024 06:49
venkatraju pushed a commit to slackhq/vitess that referenced this pull request Aug 29, 2024
…starts (vitessio#16553)

Signed-off-by: Manan Gupta <[email protected]>
Signed-off-by: Harshit Gangal <[email protected]>
Co-authored-by: Harshit Gangal <[email protected]>
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.

4 participants