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

transaction: fix union select for update race (#19006) #19022

Merged
merged 2 commits into from
Aug 6, 2020

Conversation

ti-srebot
Copy link
Contributor

cherry-pick #19006 to release-4.0


What problem does this PR solve?

union select for update statements are executed concurrently, so LockKeys is executed concurrently too, but
LockKeys is not thread-safe, cause unexpected result.

What is changed and how it works?

Lock the whole LockKeys method instead of map access.

Related changes

  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test

Release note

  • fix union select for update race

@ti-srebot
Copy link
Contributor Author

/run-all-tests

@ti-srebot ti-srebot added component/executor priority/release-blocker This issue blocks a release. Please solve it ASAP. sig/transaction SIG:Transaction type/4.0-cherry-pick type/bugfix This PR fixes a bug. labels Aug 6, 2020
@ti-srebot ti-srebot added this to the v4.0.6 milestone Aug 6, 2020
* transaction: fix LockKeys race

* do not update delta for lock keys

* fix more race

* fix another race

Co-authored-by: ti-srebot <66930949+ti-srebot@users.noreply.github.com>
@coocood coocood force-pushed the release-4.0-b36393774455 branch from 2013dd3 to 3cef071 Compare August 6, 2020 02:25
@coocood
Copy link
Member

coocood commented Aug 6, 2020

LGTM

@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Aug 6, 2020
@cfzjywxk
Copy link
Contributor

cfzjywxk commented Aug 6, 2020

LGTM

@ti-srebot ti-srebot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Aug 6, 2020
@ti-srebot ti-srebot added status/LGT3 The PR has already had 3 LGTM. and removed status/LGT2 Indicates that a PR has LGTM 2. labels Aug 6, 2020
@coocood
Copy link
Member

coocood commented Aug 6, 2020

/run-all-tests

@jebter
Copy link

jebter commented Aug 6, 2020

/merge

@ti-srebot ti-srebot added the status/can-merge Indicates a PR has been approved by a committer. label Aug 6, 2020
@ti-srebot
Copy link
Contributor Author

/run-all-tests

@ti-srebot ti-srebot merged commit 1a91fc5 into pingcap:release-4.0 Aug 6, 2020
@coocood coocood deleted the release-4.0-b36393774455 branch August 6, 2020 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/executor priority/release-blocker This issue blocks a release. Please solve it ASAP. sig/transaction SIG:Transaction status/can-merge Indicates a PR has been approved by a committer. status/LGT3 The PR has already had 3 LGTM. type/bugfix This PR fixes a bug. type/4.0-cherry-pick
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants