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

txn: change lock into put record for unique index key lock #25730

Merged
merged 5 commits into from
Jul 14, 2021

Conversation

cfzjywxk
Copy link
Contributor

@cfzjywxk cfzjywxk commented Jun 24, 2021

What problem does this PR solve?

Issue Number:
Related to #25659

Problem Summary:
Since #21229, all the unique index keys will be locked if they are used in the for update read access path. The for update read with point get on non-clusetered unique index keys may leave many LOCK records which affect the performance a lot.

What is changed and how it works?

What's Changed:
Change the LOCK record into PUT when the for update read is used for point/batch point get unqiue index read.
Record the original index value into memory buffer so that the record will be PUT.

How it Works:

Related changes

  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test

Side effects

  • Put more data into storage when the unique key index is written as the value part contains the handle value, when the point/batch point get for update read are used.

Release note

  • Change the lock record into put record for the index keys using point/batch point get for update read.

@ti-chi-bot ti-chi-bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 24, 2021
@sre-bot
Copy link
Contributor

sre-bot commented Jun 24, 2021

Please follow PR Title Format:

  • pkg [, pkg2, pkg3]: what's changed

Or if the count of mainly changed packages are more than 3, use

  • *: what's changed

@ti-srebot
Copy link
Contributor

@github-actions github-actions bot added the sig/execution SIG execution label Jun 24, 2021
@ti-chi-bot ti-chi-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 24, 2021
@cfzjywxk cfzjywxk changed the title change lock into put record for unique index key lock txn: change lock into put record for unique index key lock Jun 24, 2021
@sre-bot
Copy link
Contributor

sre-bot commented Jun 24, 2021

Please follow PR Title Format:

  • pkg [, pkg2, pkg3]: what's changed

Or if the count of mainly changed packages are more than 3, use

  • *: what's changed

@ti-srebot
Copy link
Contributor

@cfzjywxk cfzjywxk force-pushed the change_lock_to_put branch from 7d1380b to 890485a Compare June 24, 2021 06:50
@cfzjywxk
Copy link
Contributor Author

/run-all-tests

@cfzjywxk cfzjywxk marked this pull request as ready for review June 24, 2021 07:08
@cfzjywxk cfzjywxk requested a review from a team as a code owner June 24, 2021 07:08
@cfzjywxk cfzjywxk requested review from lzmhhh123 and removed request for a team June 24, 2021 07:08
@ti-chi-bot ti-chi-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 24, 2021
@cfzjywxk cfzjywxk added the sig/transaction SIG:Transaction label Jun 24, 2021
@cfzjywxk
Copy link
Contributor Author

/run-all-tests

@cfzjywxk cfzjywxk force-pushed the change_lock_to_put branch from 890485a to b389fbe Compare June 25, 2021 07:03
@lysu lysu requested review from coocood and jackysp June 25, 2021 07:19
@cfzjywxk
Copy link
Contributor Author

cfzjywxk commented Jun 25, 2021

As the change may be incorrect, close it.
The value put back is the raw value from kv, it will not be affected by the encoding policy.

@cfzjywxk cfzjywxk closed this Jun 25, 2021
@cfzjywxk cfzjywxk reopened this Jul 2, 2021
ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Jul 14, 2021
@ti-srebot
Copy link
Contributor

cherry pick to release-5.0 in PR #26224

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Jul 14, 2021
@ti-srebot
Copy link
Contributor

cherry pick to release-5.1 in PR #26225

@cfzjywxk cfzjywxk deleted the change_lock_to_put branch July 14, 2021 08:01
@MyonKeminta MyonKeminta mentioned this pull request Dec 15, 2021
12 tasks
zyguan added a commit to zyguan/tidb that referenced this pull request Mar 22, 2023
@zyguan zyguan mentioned this pull request Mar 22, 2023
12 tasks
ti-chi-bot pushed a commit that referenced this pull request Mar 23, 2023
zyguan added a commit to zyguan/tidb that referenced this pull request Mar 25, 2023
This reverts commit 3a5f434.

Signed-off-by: zyguan <[email protected]>
ti-chi-bot pushed a commit that referenced this pull request Mar 26, 2023
ti-chi-bot added a commit that referenced this pull request Apr 3, 2023
you06 added a commit to you06/tidb that referenced this pull request May 19, 2023
you06 added a commit to you06/tidb that referenced this pull request May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-5.0 needs-cherry-pick-release-5.1 sig/execution SIG execution sig/sql-infra SIG: SQL Infra sig/transaction SIG:Transaction 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants