Skip to content

transaction: resolve orphaned locks whose primary was never written#544

Open
eduralph wants to merge 1 commit into
tikv:masterfrom
getwyrd:fix/check-txn-status-multiplekeyerrors
Open

transaction: resolve orphaned locks whose primary was never written#544
eduralph wants to merge 1 commit into
tikv:masterfrom
getwyrd:fix/check-txn-status-multiplekeyerrors

Conversation

@eduralph

@eduralph eduralph commented Jul 5, 2026

Copy link
Copy Markdown

check_txn_status matched only ExtractedErrors, but its plan delivers per-key errors as MultipleKeyErrors, so the Rollback_if_not_exist escalation in get_txn_status_from_lock was unreachable and an orphaned secondary lock poisoned its key permanently. Accept both wrappers.

Refs #531

Signed-off-by: Eduard Ralph eduard@ralphovi.net

Summary by CodeRabbit

  • Bug Fixes
    • Improved transaction status handling when multiple per-key errors are returned.
    • txn_not_found errors are now recognized consistently and reported as transaction-not-found instead of a generic error.
    • Other per-key errors continue to be surfaced unchanged.

check_txn_status matched only ExtractedErrors, but its plan delivers per-key
errors as MultipleKeyErrors, so the rollback_if_not_exist escalation in
get_txn_status_from_lock was unreachable and an orphaned secondary lock
poisoned its key permanently. Accept both wrappers.

Refs tikv#531

Signed-off-by: Eduard Ralph <eduard@ralphovi.net>
@ti-chi-bot

ti-chi-bot Bot commented Jul 5, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign disksing for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot Bot added dco-signoff: yes Indicates the PR's author has signed the dco. contribution This PR is from a community contributor. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jul 5, 2026
@ti-chi-bot

ti-chi-bot Bot commented Jul 5, 2026

Copy link
Copy Markdown

Welcome @eduralph!

It looks like this is your first PR to tikv/client-rust 🎉.

I'm the bot to help you request reviewers, add labels and more, See available commands.

We want to make sure your contribution gets all the attention it needs!



Thank you, and welcome to tikv/client-rust. 😃

@ti-chi-bot ti-chi-bot Bot added the first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. label Jul 5, 2026
@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 53f61513-bb3f-46a2-a860-fe031e36622a

📥 Commits

Reviewing files that changed from the base of the PR and between e53837d and 0902af0.

📒 Files selected for processing (1)
  • src/transaction/lock.rs

📝 Walkthrough

Walkthrough

The check_txn_status function in src/transaction/lock.rs is updated so its error-handling logic also applies to Error::MultipleKeyErrors, not just Error::ExtractedErrors. Both variants now pop one error and convert a txn_not_found KeyError into Error::TxnNotFound.

Changes

check_txn_status error handling

Layer / File(s) Summary
Expand error match arm to cover MultipleKeyErrors
src/transaction/lock.rs
check_txn_status now handles Error::MultipleKeyErrors the same way it handles Error::ExtractedErrors: pop one error and convert a txn_not_found KeyError into Error::TxnNotFound, otherwise return the error as-is.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related issues

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the PR’s main goal: fixing orphaned lock handling caused by transaction status wrappers.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Labels

contribution This PR is from a community contributor. dco-signoff: yes Indicates the PR's author has signed the dco. first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant