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

[close #757] Support verifying primary for check_txn_status #758

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

shiyuhang0
Copy link
Collaborator

@shiyuhang0 shiyuhang0 commented Jun 27, 2023

What problem does this PR solve?

Issue Number: close #757

Problem Description: TBD

What is changed and how does it work?

tikv/client-go#777

  1. set VerifyIsPrimary to true for KvCheckTxnStatus RPC in client-java. TiKV will check if the primary lock is actually the primary. If not, it will not resolve the primary lock and throw a primaryMismatch error.
  2. Judge primaryMismatch for PessimisticLock and resolve this PessimisticLock in client-java.
  3. As for the primaryMismatch for non-PessimisticLock, TiKV will handle it and it will not happen in the client. If we meet it, just throw an exception.

TODO

  1. add a test for this PR.
  2. test if it works with lower version TiKV

Signed-off-by: shiyuhang <[email protected]>
@codecov
Copy link

codecov bot commented Jun 27, 2023

Codecov Report

Patch coverage: 38.09% and project coverage change: -0.08 ⚠️

Comparison is base (cb26d58) 37.93% compared to head (5d8b7b6) 37.85%.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #758      +/-   ##
============================================
- Coverage     37.93%   37.85%   -0.08%     
+ Complexity     1613     1609       -4     
============================================
  Files           278      279       +1     
  Lines         17517    17536      +19     
  Branches       1992     1996       +4     
============================================
- Hits           6645     6639       -6     
- Misses        10208    10225      +17     
- Partials        664      672       +8     
Impacted Files Coverage Δ
...g/tikv/txn/exception/PrimaryMismatchException.java 0.00% <0.00%> (ø)
...c/main/java/org/tikv/txn/LockResolverClientV4.java 41.75% <40.00%> (-0.87%) ⬇️

... and 6 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ResolveLocks for pessimistic transaction that has switched primary may break transaction atomicity
1 participant