Skip to content

kv: zero CommitTS when StartTS is auto-assigned in coordinators#413

Merged
bootjp merged 2 commits intofeature/s3-implfrom
copilot/sub-pr-396
Mar 23, 2026
Merged

kv: zero CommitTS when StartTS is auto-assigned in coordinators#413
bootjp merged 2 commits intofeature/s3-implfrom
copilot/sub-pr-396

Conversation

Copy link
Contributor

Copilot AI commented Mar 23, 2026

When StartTS == 0 and a coordinator auto-assigns it, any caller-provided CommitTS was still forwarded into dispatchTxn. Since the freshly-issued StartTS is generated from the HLC at dispatch time, a pre-supplied CommitTS can easily satisfy CommitTS <= StartTS, producing an invalid transaction or observing an arbitrary external timestamp into the clock.

Changes

  • kv/coordinator.go: Zero reqs.CommitTS alongside reqs.StartTS assignment when StartTS == 0, so dispatchTxn generates both timestamps consistently.
  • kv/sharded_coordinator.go: Same fix in the sharded path — clear CommitTS whenever the coordinator assigns StartTS.

This mirrors the existing redirect() logic, which already clears CommitTS when forwarding a txn without a StartTS:

// Before (both coordinators):
if reqs.IsTxn && reqs.StartTS == 0 {
    reqs.StartTS = c.nextStartTS()
    // CommitTS still forwarded — could be <= newly assigned StartTS
}

// After:
if reqs.IsTxn && reqs.StartTS == 0 {
    reqs.StartTS = c.nextStartTS()
    reqs.CommitTS = 0  // let dispatchTxn derive CommitTS from the real StartTS
}

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add s3 adapter kv: zero CommitTS when StartTS is auto-assigned in coordinators Mar 23, 2026
Copilot AI requested a review from bootjp March 23, 2026 10:44
@bootjp bootjp marked this pull request as ready for review March 23, 2026 12:32
@bootjp bootjp merged commit 9a09659 into feature/s3-impl Mar 23, 2026
4 checks passed
@bootjp bootjp deleted the copilot/sub-pr-396 branch March 23, 2026 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants