client-java icon indicating copy to clipboard operation
client-java copied to clipboard

[close #757] Support verifying primary for check_txn_status

Open shiyuhang0 opened this issue 2 years ago • 1 comments

What problem does this PR solve?

Issue Number: close #757

Problem Description: TBD

What is changed and how does it work?

https://github.com/tikv/client-go/pull/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

shiyuhang0 avatar Jun 27 '23 10:06 shiyuhang0

Codecov Report

:x: Patch coverage is 38.09524% with 13 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 37.85%. Comparing base (cb26d58) to head (5d8b7b6). :warning: Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
...c/main/java/org/tikv/txn/LockResolverClientV4.java 40.00% 10 Missing and 2 partials :warning:
...g/tikv/txn/exception/PrimaryMismatchException.java 0.00% 1 Missing :warning:
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     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Jun 27 '23 11:06 codecov[bot]