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

EtcdWorker: fix EtcdWorker snapshot isolation #2510

Merged
merged 7 commits into from
Aug 17, 2021

Conversation

liuzix
Copy link
Contributor

@liuzix liuzix commented Aug 12, 2021

What problem does this PR solve?

  • EtcdWorker's snapshot isolation is violated if there are two concurrent transactions one deleting and the other putting to the same key.
  • EtcdWorker's snapshot isolation is violated if while A is running and trying to create a key k, B and C creates and deletes k sequentially.

What is changed and how it works?

  • For the first case, we use equality of mod_revision to check for write-set intersection instead of inequality.
  • For the second case, we use a global deleteCounter as a key to make deletions impossible to race with other operations.

Check List

Tests

  • Unit test
  • Integration test

Code changes

  • Has persistent data change

Side effects

  • Possible performance regression
  • Increased code complexity

Related changes

  • Need to cherry-pick to the release branch

Release note

Fix a bug in metadata management

@liuzix liuzix added type/bugfix This PR fixes a bug. component/scheduler TiCDC inner scheduler component. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Aug 12, 2021
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Aug 12, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • amyangfei
  • overvenus

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Aug 12, 2021
@ti-chi-bot ti-chi-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 12, 2021
@liuzix liuzix added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 12, 2021
@liuzix
Copy link
Contributor Author

liuzix commented Aug 12, 2021

/run-integration-tests

2 similar comments
@liuzix
Copy link
Contributor Author

liuzix commented Aug 12, 2021

/run-integration-tests

@liuzix
Copy link
Contributor Author

liuzix commented Aug 12, 2021

/run-integration-tests

Copy link
Member

@overvenus overvenus left a comment

Choose a reason for hiding this comment

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

Could you add some tests?

pkg/orchestrator/etcd_worker.go Outdated Show resolved Hide resolved
@liuzix liuzix force-pushed the zixiong-fix-etcd-worker-isolation branch from 8f5a850 to b3c5d38 Compare August 13, 2021 15:00
@ti-chi-bot ti-chi-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 13, 2021
@liuzix
Copy link
Contributor Author

liuzix commented Aug 13, 2021

/run-integration-tests

2 similar comments
@liuzix
Copy link
Contributor Author

liuzix commented Aug 13, 2021

/run-integration-tests

@liuzix
Copy link
Contributor Author

liuzix commented Aug 16, 2021

/run-integration-tests

@liuzix
Copy link
Contributor Author

liuzix commented Aug 16, 2021

/run-integration-tests

@liuzix
Copy link
Contributor Author

liuzix commented Aug 16, 2021

/run-integration-tests

2 similar comments
@liuzix
Copy link
Contributor Author

liuzix commented Aug 16, 2021

/run-integration-tests

@liuzix
Copy link
Contributor Author

liuzix commented Aug 16, 2021

/run-integration-tests

@amyangfei amyangfei added needs-cherry-pick-release-5.0 Should cherry pick this PR to release-5.0 branch. needs-cherry-pick-release-5.1 Should cherry pick this PR to release-5.1 branch. needs-cherry-pick-release-5.2 Should cherry pick this PR to release-5.2 branch. labels Aug 17, 2021
@amyangfei
Copy link
Contributor

/unhold

@amyangfei amyangfei removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 17, 2021
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Aug 17, 2021
@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Aug 17, 2021
@overvenus
Copy link
Member

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: d7127b3

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Aug 17, 2021
@amyangfei
Copy link
Contributor

/run-integration-tests
/run-kafka-tests

@amyangfei
Copy link
Contributor

/run-kafka-tests

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #2557.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #2558.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #2559.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #2560.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-approved Cherry pick PR approved by release team. component/scheduler TiCDC inner scheduler component. needs-cherry-pick-release-4.0 Should cherry pick this PR to release-4.0 branch. needs-cherry-pick-release-5.0 Should cherry pick this PR to release-5.0 branch. needs-cherry-pick-release-5.1 Should cherry pick this PR to release-5.1 branch. needs-cherry-pick-release-5.2 Should cherry pick this PR to release-5.2 branch. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants