Skip to content

fixup - #156

Merged
chuandew merged 2 commits into
dingodb:mainfrom
visualYJD:yjd-dev
Jul 28, 2026
Merged

fixup#156
chuandew merged 2 commits into
dingodb:mainfrom
visualYJD:yjd-dev

Conversation

@visualYJD

Copy link
Copy Markdown
Contributor

No description provided.

visualYJD and others added 2 commits July 28, 2026 09:41
TSO acquisition time was invisible in TraceMetrics: Begin()'s GenTs is
not covered by any per-phase metric (showing up only as a gap between
total_time_us and the sum of parts), and the forced FetchTso inside
prewrite is indistinguishable from real prewrite work. Under high
concurrency the TSO rwlock convoy makes both segments dominate the
transaction latency.

Add tso(time_us count) to TraceMetrics, accumulated at the five
critical-path TSO call sites: Begin start_ts, prewrite physical_ts,
1pc/async-commit commit_ts, 2PC DoCommit and CommitPrimaryKey retry.
The prewrite/commit portion overlaps the corresponding sdk_time_us by
design; background heartbeat and lock-resolver calls are not counted.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…cal time

GenPhysicalTs unconditionally does Refresh + FetchTso under the
process-wide tso write lock on every prewrite round and heartbeat. The
fetched physical time only feeds lock_ttl (deadline granularity 20s),
yet under high concurrency the lock convoy makes apparent tso latency
grow linearly with thread count (queue depth x rpc RTT), dominating
small-transaction latency; the Refresh also discards the GenTs batch
cache, forcing Begin to refetch as well.

Add TsoProvider::GetPhysicalTs: extrapolate current physical ms from an
anchor (tso physical + steady_clock captured on every FetchTso) under
the read lock, monotonically clamped, falling back to a real fetch only
when the anchor is older than tso_anchor_max_age_us (default 60s). The
anchor stays ms-fresh in practice since Begin's GenTs refetches after
any idle gap beyond stale_period_us. Extrapolation error (50ms server
tick + local clock drift) is negligible against the 19s ttl margin.
Prewrite and heartbeat switch to it; start_ts/commit_ts/min_commit_ts
still use GenTs for global ordering, and lock resolver is unchanged.

128-thread benchmark on a local cluster: per-txn tso time p50 26ms ->
45us, trace total-vs-parts gap p50 12.9ms -> 63us, throughput +50%,
coordinator fetches 1.4 -> 0.14 per txn.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@chuandew
chuandew added this pull request to the merge queue Jul 28, 2026
Merged via the queue into dingodb:main with commit 4924507 Jul 28, 2026
1 check passed
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