Hybrid Logical Clocks (HLC) concept page. Shows how CockroachDB combines physical timestamp + logical counter to get monotonic clock close to wall-time. Algorithm: hlc.l = max(local_phys, hlc.l, msg.l); hlc.c = increment if equal else 0. Bounded clock skew assumption (max_offset 500ms). Scenarios: normal operation, NTP skew tolerance, comparison with Lamport and TrueTime, MVCC snapshot read. Two ADRs explaining HLC tuple design and why CockroachDB chose HLC over Spanner TrueTime.
A hybrid logical clock is a pair (l,c): a physical-time-like component and a logical counter. Its update rules keep timestamps close to physical time while preserving the one-way causal property e -> f => HLC(e) < HLC(f) under lexicographic comparison.
The converse is false. Concurrent events can have ordered HLC values because physical readings differ. HLCs support versioning and snapshots, but do not create linearizable reads, serializable transactions, bounded uncertainty, or consensus decisions.
l=max(l,physicalNow) and increments c when physical time does not advance; otherwise it resets c.local-tick): Physical progress resets c; equal physical time increments it.receive-causality): Receive dominates the remote send even when local physical time lags.logical-tie): Several events at one physical reading remain ordered locally.backward-clock): A backward wall-clock step must not lower published HLC.restart-state): Durable state prevents an earlier timestamp after restart.concurrent-events): Independent events can have ordered HLC values without a causal path.counter-overflow): A fixed-width c cannot silently wrap while l is pinned.linearizability-boundary): A separate protocol determines visibility of an HLC-stamped operation.Введите числа или выберите пресет