Skip to content

feat: batch TSO requests and low-resolution timestamp cache (#420) - #538

Merged
s2x merged 5 commits into
masterfrom
fix/420-batch-tso-low-res-cache
Sep 9, 2026
Merged

feat: batch TSO requests and low-resolution timestamp cache (#420)#538
s2x merged 5 commits into
masterfrom
fix/420-batch-tso-low-res-cache

Conversation

@s2x

@s2x s2x commented Sep 9, 2026

Copy link
Copy Markdown
Member

Description

Closes #420

Batch TSO requests and add a low-resolution timestamp cache, cutting PD round trips on hot paths.

Changes

  • New PdClientInterface::getTimestampBatch(int $count) requests up to $count timestamps in a single Tso RPC; grants are handed out as consecutive values with correct 18-bit logical wrap, never exceeding the granted count.
  • New PdClientInterface::getLowResolutionTimestamp() serves a timestamp cached for at most lowResTimestampMaxStalenessMs (default unset = fresh RPC per call, behaviour unchanged); negative clock age is treated as stale.
  • Lock resolution (CheckTxnStatus.current_ts) uses the low-resolution timestamp; start/commit timestamps never do.
  • pessimisticLockBatch() acquires one for_update_ts per locking pass instead of one per region, saving one PD round trip per additional locked region.
  • Added unit test asserting a two-region pessimistic locking pass shares one for_update_ts and spends only one TSO call.

Changelog

  • [GAP-06]: batched TSO requests and a low-resolution timestamp cache (see CHANGELOG.md for the full entry).

Code Review

  • Pending subagent code review

@s2x s2x self-assigned this Sep 9, 2026
@s2x
s2x force-pushed the fix/420-batch-tso-low-res-cache branch from 10e9732 to 81fa04c Compare September 9, 2026 18:29
@s2x
s2x marked this pull request as ready for review September 9, 2026 19:34
@s2x
s2x force-pushed the fix/420-batch-tso-low-res-cache branch from f792f0c to b9f8f3b Compare September 9, 2026 19:34
@s2x
s2x merged commit 275c09e into master Sep 9, 2026
9 checks passed
@s2x
s2x deleted the fix/420-batch-tso-low-res-cache branch September 9, 2026 19:37
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.

[GAP-06] Batch TSO requests and add a low-resolution timestamp cache

1 participant