Repository navigation
Conversation
close pingcap/tidb#69831 Signed-off-by: nikita.massalitin <massalitine@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @lohmag. Thanks for your PR. I'm waiting for a tikv member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
Welcome @lohmag! |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Check async transaction age before prewrite txnkv/transaction/2pc.go, integration_tests/async_commit_fail_test.go |
Async commits that exceed MaxTxnTimeUse now return an age error before prewrite. The existing later age check applies only to non-async commits. The integration test checks the error, confirms zero prewrite RPCs, and verifies neither key is visible. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Medium
Suggested reviewers: ekexium
Merge Risk: 
Minimal · up to a16c9
-
The change rejects over-age async transactions before prewrite. No issue requiring a fix before merge was identified.
Pre-merge checks: 
5
-
Full details: Linked Issues check
-
Explanation
Issue [
#69831] requires an over-age async-commit transaction to fail before prewrite, or to return a result that matches its durable outcome. The change checksMaxTxnTimeUsebefore prewrite whenc.isAsyncCommit()is true. It skips the later age check only for async commit, so a transaction that falls back to 2PC retains the later check.TestAsyncCommitTooOldTxnNotPrewrittenverifies the age error, zero prewrite RPCs, and absent keys.
Full details: Out of Scope Changes check
-
Explanation
The change is limited to the async-commit age-check ordering in
txnkv/transaction/2pc.goand a focused integration test inintegration_tests/async_commit_fail_test.go. Both changes directly implement and verify issue [#69831]. No unrelated production behavior or test scope is present in the reviewed diff.
Full details: Docstring Coverage
-
Explanation
No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files.
-
Finishing Touches: 💡 1
-
🛠️ Fix failing CI checks: 💡
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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 @coderabbitai help to get the list of available commands.
Issue Number: close pingcap/tidb#69831
Problem Summary:
An async commit transaction is committed as soon as all its prewrites succeed: the primary lock carries the secondaries and a lock resolver can commit it.
executechecksMaxTxnTimeUseonly after prewrite, so a transaction older than 24 hours prewrites, then getstxn takes too much time. The caller sees an ordinary failure while the cleanup runs in the background. If that cleanup does not finish (process exit, store closed, primary unreachable), a later reader resolves the locks as committed, and a retry of the "failed" transaction applies it twice.What is changed:
MaxTxnTimeUsebefore prewrite, so a too old transaction fails before it writes any lock.Tests:
TestAsyncCommitFail/TestAsyncCommitTooOldTxnNotPrewritten: an oracle reports theMaxTxnTimeUseage as expired. It fails without the fix (one prewrite is sent) and passes with it, on unistore and on a real TiKV playground (nightly).commitFailedSkipCleanup+ expired locks) recovered both keys as committed before the fix on real TiKV. With the fixCommitfails before prewrite and the keys stay absent.go test ./txnkv/... ./tikv/...,cd integration_tests && go test .(unistore), andgo test . -run 'TestAsyncCommit|TestAsyncCommitFail|Test1PC|TestCommitter' -with-tikvagainst a real TiKV pass.Summary by CodeRabbit