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: introduce the statement buffer of pessimistic lock cache #43530

Merged
merged 3 commits into from
May 11, 2023

Conversation

ekexium
Copy link
Contributor

@ekexium ekexium commented May 4, 2023

What problem does this PR solve?

Issue Number: close #43294

Problem Summary:

What is changed and how it works?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

Signed-off-by: ekexium <[email protected]>
@ti-chi-bot
Copy link

ti-chi-bot bot commented May 4, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • you06
  • zyguan

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
Copy link

ti-chi-bot bot commented May 4, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/needs-triage-completed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. and removed do-not-merge/needs-triage-completed labels May 4, 2023
@ekexium ekexium force-pushed the rc-inconsistency-failed-dml branch from 4f3bcd2 to 078380c Compare May 4, 2023 10:08
@ekexium
Copy link
Contributor Author

ekexium commented May 4, 2023

/test all

@ekexium ekexium force-pushed the rc-inconsistency-failed-dml branch from 078380c to b4dae6e Compare May 4, 2023 10:36
@ekexium
Copy link
Contributor Author

ekexium commented May 4, 2023

/test all

@ekexium ekexium force-pushed the rc-inconsistency-failed-dml branch from b4dae6e to de40c80 Compare May 4, 2023 11:36
@ekexium ekexium marked this pull request as ready for review May 4, 2023 11:51
@ekexium ekexium requested a review from a team as a code owner May 4, 2023 11:51
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 4, 2023
@ekexium ekexium force-pushed the rc-inconsistency-failed-dml branch 8 times, most recently from d8e51c9 to fd30492 Compare May 5, 2023 09:45
@ekexium ekexium force-pushed the rc-inconsistency-failed-dml branch from fd30492 to 91441ab Compare May 5, 2023 10:34
@ekexium ekexium requested review from zyguan and MyonKeminta May 5, 2023 10:35
@ekexium
Copy link
Contributor Author

ekexium commented May 6, 2023

/retest

@cfzjywxk cfzjywxk requested a review from you06 May 10, 2023 16:05
@ti-chi-bot ti-chi-bot bot added the status/LGT1 Indicates that a PR has LGTM 1. label May 11, 2023
Copy link
Contributor

@you06 you06 left a comment

Choose a reason for hiding this comment

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

rest LGTM

return
}
if tc.pessimisticLockCache == nil {
tc.pessimisticLockCache = make(map[string][]byte)
Copy link
Contributor

@you06 you06 May 11, 2023

Choose a reason for hiding this comment

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

Suggested change
tc.pessimisticLockCache = make(map[string][]byte)
tc.pessimisticLockCache, tc.CurrentStmtPessimisticLockCache = tc.CurrentStmtPessimisticLockCache, tc.pessimisticLockCache
return

Can we just assign tc.CurrentStmtPessimisticLockCache to tc.pessimisticLockCache to avoid reallocate?

@ti-chi-bot ti-chi-bot bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels May 11, 2023
@zyguan
Copy link
Contributor

zyguan commented May 11, 2023

/merge

@ti-chi-bot
Copy link

ti-chi-bot bot commented May 11, 2023

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

Commit hash: 592eba1

@ti-chi-bot ti-chi-bot bot added the status/can-merge Indicates a PR has been approved by a committer. label May 11, 2023
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.1: #43722.

Comment on lines +400 to +401
CurrentStmtPessimisticLockCache := make(map[string][]byte, len(tc.CurrentStmtPessimisticLockCache))
maps.Copy(CurrentStmtPessimisticLockCache, tc.CurrentStmtPessimisticLockCache)
Copy link
Contributor

Choose a reason for hiding this comment

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

The map CurrentStmtPessimisticLockCache is never used? Should put it into TxnCtxNeedToRestore?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I think no need to put CurrentStmtPessimisticLockCache into TxnCtxNeedToRestore, then we can just remove those 2 line code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I think no need to put CurrentStmtPessimisticLockCache into TxnCtxNeedToRestore, then we can just remove those 2 line code?

Yes. It must be a mistake during refactoring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. release-note-none Denotes a PR that doesn't merit a release note. 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.

Failed DML in RC pessimistic transaction may break data consistency
6 participants