Skip to content

Conversation

@pingyu
Copy link
Collaborator

@pingyu pingyu commented Jan 20, 2026

Cherry pick #491

Changes

  • Add retry loop for KeyError::commit_ts_expired when committing the primary key, mirroring client-go’s actionCommit::handleSingleBatch logic (src/transaction/transaction.rs).
  • Improve error visibility/logging for primary commit failures and key mismatch (uses HexRepr) (src/transaction/transaction.rs, src/kv/mod.rs).
  • Fix HasKeyErrors for Result<T, Error> to preserve structured errors (especially MultipleKeyErrors) instead of stringifying, enabling correct extraction/matching (src/store/errors.rs).
  • Improve test helper error message when PD HTTP response body isn’t valid JSON (tests/common/ctl.rs).

Compare with Go implementation (https://github.com/tikv/client-go/blob/tidb-8.5/txnkv/transaction/commit.go) by LLM:

  • commit_ts_expired handling: Committer::commit_primary_with_retry in src/transaction/transaction.rs:1408 matches actionCommit::handleSingleBatch’s CommitTsExpired branch—logs, verifies the rejected key is the
    primary (:1419-1424), rejects “too large min_commit_ts” (:1426-1436), and retries (:1437). Rust retries by re-running commit_primary() which re-fetches a fresh TSO and rebuilds the commit request (:1372-1406),
    which is equivalent to Go’s “update commitTS + update request + continue”.

Signed-off-by: Ping Yu <yuping@pingcap.com>
Signed-off-by: Ping Yu <yuping@pingcap.com>
@ti-chi-bot ti-chi-bot bot added dco-signoff: yes Indicates the PR's author has signed the dco. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 20, 2026
@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Jan 20, 2026
@ti-chi-bot ti-chi-bot bot added the lgtm label Jan 20, 2026
@ti-chi-bot
Copy link

ti-chi-bot bot commented Jan 20, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: coocood, iosmanthus

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 20, 2026
@ti-chi-bot
Copy link

ti-chi-bot bot commented Jan 20, 2026

[LGTM Timeline notifier]

Timeline:

  • 2026-01-20 12:25:58.444855303 +0000 UTC m=+496786.058812159: ☑️ agreed by coocood.
  • 2026-01-20 12:28:59.215054551 +0000 UTC m=+496966.829011407: ☑️ agreed by iosmanthus.

@ti-chi-bot ti-chi-bot bot merged commit 353e52d into tikv:master Jan 20, 2026
7 checks passed
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.

3 participants