transaction: resolve orphaned locks whose primary was never written#544
transaction: resolve orphaned locks whose primary was never written#544eduralph wants to merge 4 commits into
Conversation
|
Welcome @eduralph! |
📝 WalkthroughWalkthrough
ChangesTransaction status error handling
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
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>
Add a regression test for the MultipleKeyErrors fix: an expired lock whose
primary was never written must escalate to rollback_if_not_exist and resolve,
rather than surfacing the raw error. The test asserts the two CheckTxnStatus
calls and fails on the pre-fix code with MultipleKeyErrors([KeyError { .. }]).
Also correct the new comment: the key errors are produced by
single_shard_handler, not single_plan_handler, and name CollectSingle as the
reason this call site differs from the plans that never see MultipleKeyErrors.
Refs tikv#531
Signed-off-by: Eduard Ralph <eduard@ralphovi.net>
0902af0 to
f6cf433
Compare
|
@ekexium to raise awareness |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ekexium The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
|
@pingyu - we're 1 LGTM away from getting this merged |
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
txn_not_foundis now consistently reported as “transaction not found” instead of a generic error.