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

executor: fix auto retry when transaction has select for update (#11714) #11718

Merged
merged 1 commit into from
Aug 12, 2019

Conversation

sre-bot
Copy link
Contributor

@sre-bot sre-bot commented Aug 12, 2019

cherry-pick #11714 to release-3.0


What problem does this PR solve?

When @@tidb_disable_txn_auto_retry is set to 0, transactions will retry automatically when there are write conflicts, but when there are select for update statements, auto-retry should be prevented. A previous PR #10972 makes point get plan supports select for update, but didn't set TransactionContext.ForUpdate to true, so the transaction will retry even it has select for update statements.

What is changed and how it works?

extract a function doLockKeys that used by both SelectLock executor and PointGet executor. In this function, set TransactionContext.ForUpdate to true.

Check List

Tests

  • Unit test

Code changes

  • Has exported variable/fields change

Related changes

  • Need to cherry-pick to the release branch
  • Need to be included in the release note

@sre-bot
Copy link
Contributor Author

sre-bot commented Aug 12, 2019

/run-all-tests

Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

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

LGTM

@zz-jason zz-jason added the status/LGT1 Indicates that a PR has LGTM 1. label Aug 12, 2019
@tiancaiamao
Copy link
Contributor

LGTM

@tiancaiamao tiancaiamao added status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Aug 12, 2019
@sre-bot
Copy link
Contributor Author

sre-bot commented Aug 12, 2019

/run-all-tests

@ngaut ngaut merged commit 5f95ee5 into pingcap:release-3.0 Aug 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority/release-blocker This issue blocks a release. Please solve it ASAP. 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.

5 participants