Skip to content

txnkv: fix SetCommitWaitUntilTSOTimeout does not work in causal consistency#1847

Merged
ti-chi-bot[bot] merged 1 commit intotikv:masterfrom
lcwangchao:wait_tso_causal_consistency
Jan 21, 2026
Merged

txnkv: fix SetCommitWaitUntilTSOTimeout does not work in causal consistency#1847
ti-chi-bot[bot] merged 1 commit intotikv:masterfrom
lcwangchao:wait_tso_causal_consistency

Conversation

@lcwangchao
Copy link
Contributor

@lcwangchao lcwangchao commented Jan 19, 2026

fix #1846

Summary by CodeRabbit

Release Notes

  • Tests

    • Expanded test coverage for async commit functionality and causal consistency validation in transaction processing scenarios.
  • Bug Fixes

    • Improved commit timestamp calculation to correctly handle deferred wait-until-timestamp requirements, particularly when combined with async commit and causal consistency features.

✏️ Tip: You can customize this high-level summary in your review settings.

@ti-chi-bot ti-chi-bot bot added the dco-signoff: yes Indicates the PR's author has signed the dco. label Jan 19, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 19, 2026

📝 Walkthrough

Walkthrough

This PR fixes a bug where SetCommitWaitUntilTSO didn't work when causal consistency was enabled. The fix modifies the timestamp fetch condition in the two-phase commit flow to also trigger when commitWaitUntilTSO is configured, independent of linearizability requirements. Test coverage is expanded to verify the fix.

Changes

Cohort / File(s) Summary
Test case expansion
integration_tests/option_test.go
Removed early skip guard; introduced extraPrepare test parameter to enable configurable transaction options. Added two test cases for async commit with 1PC and causal consistency scenarios.
Core commit logic
txnkv/transaction/2pc.go
Modified condition for fetching commit timestamp from TSO: now triggers when commitTSMayBeCalculated && (needLinearizability() || txn.commitWaitUntilTSO > 0) instead of only checking needLinearizability.
Dependency update
go.mod
Minor manifest version adjustments.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A carrot grows when timestamps align,
No more causal confusion, the logic's so fine,
With two-phase commits now working their grace,
TSO waits without leaving a trace,
Consistency blooms in this protocol's embrace! 🥕

🚥 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 accurately describes the core fix: enabling SetCommitWaitUntilTSOTimeout to work when causal consistency is enabled, which directly addresses the problem identified in the changeset.
Linked Issues check ✅ Passed The code changes successfully address issue #1846 by modifying the condition to fetch commit timestamps even when causal consistency is enabled, allowing SetCommitWaitUntilTSO to work as intended.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing SetCommitWaitUntilTSO behavior with causal consistency; the test additions and conditional logic modifications are scoped to addressing the linked issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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

@ti-chi-bot ti-chi-bot bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jan 19, 2026
…sistency

Signed-off-by: Chao Wang <cclcwangchao@hotmail.com>
@ti-chi-bot
Copy link

ti-chi-bot bot commented Jan 20, 2026

@tiancaiamao: adding LGTM is restricted to approvers and reviewers in OWNERS files.

Details

In response to this:

Instructions 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.

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Jan 21, 2026
@ti-chi-bot ti-chi-bot bot added the lgtm label Jan 21, 2026
@ti-chi-bot
Copy link

ti-chi-bot bot commented Jan 21, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cfzjywxk, ekexium, tiancaiamao

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

The pull request process is described 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 removed the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jan 21, 2026
@ti-chi-bot
Copy link

ti-chi-bot bot commented Jan 21, 2026

[LGTM Timeline notifier]

Timeline:

  • 2026-01-21 06:15:30.664514004 +0000 UTC m=+560958.278470860: ☑️ agreed by cfzjywxk.
  • 2026-01-21 07:05:55.207030015 +0000 UTC m=+563982.820986871: ☑️ agreed by ekexium.

@ti-chi-bot ti-chi-bot bot merged commit 5e4b14e into tikv:master Jan 21, 2026
13 checks passed
@lcwangchao lcwangchao deleted the wait_tso_causal_consistency branch January 21, 2026 07:34
lcwangchao added a commit to lcwangchao/client-go that referenced this pull request Jan 26, 2026
…sistency (tikv#1847)

fix tikv#1846

Signed-off-by: Chao Wang <cclcwangchao@hotmail.com>
lcwangchao added a commit to lcwangchao/client-go that referenced this pull request Jan 26, 2026
…sistency (tikv#1847)

fix tikv#1846

Signed-off-by: Chao Wang <cclcwangchao@hotmail.com>
lcwangchao added a commit to lcwangchao/client-go that referenced this pull request Jan 26, 2026
…sistency (tikv#1847)

fix tikv#1846

Signed-off-by: Chao Wang <cclcwangchao@hotmail.com>
lcwangchao added a commit to lcwangchao/client-go that referenced this pull request Jan 26, 2026
…sistency (tikv#1847)

fix tikv#1846

Signed-off-by: Chao Wang <cclcwangchao@hotmail.com>
lcwangchao added a commit to lcwangchao/client-go that referenced this pull request Jan 26, 2026
…sistency (tikv#1847)

fix tikv#1846

Signed-off-by: Chao Wang <cclcwangchao@hotmail.com>
lcwangchao added a commit to lcwangchao/client-go that referenced this pull request Jan 26, 2026
…sistency (tikv#1847)

fix tikv#1846

Signed-off-by: Chao Wang <cclcwangchao@hotmail.com>
wshwsh12 pushed a commit to wshwsh12/client-go that referenced this pull request Feb 10, 2026
…sistency (tikv#1847)

fix tikv#1846

Signed-off-by: Chao Wang <cclcwangchao@hotmail.com>
wshwsh12 pushed a commit to wshwsh12/client-go that referenced this pull request Feb 10, 2026
…sistency (tikv#1847)

fix tikv#1846

Signed-off-by: Chao Wang <cclcwangchao@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved dco-signoff: yes Indicates the PR's author has signed the dco. lgtm size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SetCommitWaitUntilTSO does not work after SetCausalConsistency(true)

4 participants