Skip to main content

Module closed_timestamp

Module closed_timestamp 

Source
Expand description

Per-group closed-timestamp tracker with HLC skew bounding.

Every time a Raft group applies a committed entry, the applier records the wall-clock instant as that group’s “closed timestamp”. A follower whose closed timestamp for a group is within the caller’s staleness bound can serve reads locally — no gateway hop to the leader.

§HLC integration

The tracker also owns the node-wide HlcClock. When an apply path knows the leader-stamped Hlc for the entry it is applying, it should call ClosedTimestampTracker::fold_remote_hlc instead of ClosedTimestampTracker::mark_applied. Folding the remote HLC into the local clock bounds cross-node _ts_system skew at this node: any subsequent local stamp is strictly greater than every observed remote HLC, so versions written here can never collide with — or appear earlier than — versions a leader has already replicated.

Apply-side wiring is intentionally optional. Code paths that don’t yet thread the leader’s HLC keep using mark_applied and only lose the cross-node skew bound; correctness of the local _ts_system stamp is unaffected because HlcClock::now already advances past the local wall clock.

Structs§

ClosedTimestampTracker
Tracks the most recent apply instant per Raft group plus the shared node-wide HLC.