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: fix pessimitic exist check(#19004) #19019

Merged
merged 2 commits into from
Aug 6, 2020

Conversation

cfzjywxk
Copy link
Contributor

@cfzjywxk cfzjywxk commented Aug 5, 2020

What problem does this PR solve?

Cherry-pick #19004 to release 4.0 to close #18958

What is changed and how it works?

What's Changed:

  • Record the keys having presume not exist flag in statement context. Pass the exist map using txn.SetOption interface and the exist map will be used in unionStore.Get. It's different from the master branch behaviour.
  • Record pessimistic lock values for both point get and non point get locks, these value will be used to check existence.
  • Check existence if needed in LockKeys function for pessimistic transactions, report error if the value already exists.

How it Works:

Related changes

Check List

Tests

  • Unit test

Side effects

Release note

  • fix key existence check for pessimistic transactions.

@cfzjywxk cfzjywxk added type/bugfix This PR fixes a bug. require-LGT3 Indicates that the PR requires three LGTM. sig/transaction SIG:Transaction type/4.0-cherry-pick labels Aug 5, 2020
@cfzjywxk cfzjywxk requested review from lysu, coocood, jackysp and bobotu August 5, 2020 13:26
@cfzjywxk
Copy link
Contributor Author

cfzjywxk commented Aug 5, 2020

/run-all-tests

@@ -360,10 +362,26 @@ func (txn *tikvTxn) LockKeys(ctx context.Context, lockCtx *kv.LockCtx, keysInput
}
}()
txn.mu.Lock()
logutil.Logger(ctx).Info("[for debug] key len", zap.Int("len", len(keysInput)))
Copy link
Member

Choose a reason for hiding this comment

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

should we remove this debug log?

@cfzjywxk
Copy link
Contributor Author

cfzjywxk commented Aug 5, 2020

/run-all-tests

@cfzjywxk
Copy link
Contributor Author

cfzjywxk commented Aug 5, 2020

/run-unit-test

Copy link
Contributor

@bobotu bobotu left a comment

Choose a reason for hiding this comment

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

LGTM

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

@lysu lysu left a comment

Choose a reason for hiding this comment

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

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 5, 2020
@coocood
Copy link
Member

coocood commented Aug 6, 2020

LGTM

@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
@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

/run-all-tests

@ti-srebot ti-srebot merged commit 4fb518b into pingcap:release-4.0 Aug 6, 2020
@cfzjywxk cfzjywxk deleted the fix_ins_check_4_0 branch August 6, 2020 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/executor require-LGT3 Indicates that the PR requires three LGTM. 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.

7 participants