Skip to content

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

Open
shiyuhang0 wants to merge 3 commits into
tikv:masterfrom
shiyuhang0:check-txn-status-priamry-mismatch
Open

[close #757] Support verifying primary for check_txn_status#758
shiyuhang0 wants to merge 3 commits into
tikv:masterfrom
shiyuhang0:check-txn-status-priamry-mismatch

Conversation

@shiyuhang0

@shiyuhang0shiyuhang0 commented Jun 27, 2023

Copy link
Copy Markdown
Collaborator

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 <1136742008@qq.com>
Signed-off-by: shiyuhang <1136742008@qq.com>
Signed-off-by: shiyuhang <1136742008@qq.com>
@codecov

codecovBot commented Jun 27, 2023

Copy link
Copy Markdown

Codecov Report

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

Files with missing linesPatch %Lines
...c/main/java/org/tikv/txn/LockResolverClientV4.java40.00%10 Missing and 2 partials ⚠️
...g/tikv/txn/exception/PrimaryMismatchException.java0.00%1 Missing ⚠️
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 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Sign up for freeto 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

@shiyuhang0