LinearizableRegister.read() broadcasts a read through consensus rather than reading locally; explore why this is necessary and when you can avoid it (e.g., leader leases)Date: 2026-05-29
Time: 14:25
I don't have access to read the LinearizableRegister class directly (it starts at line 479 of total-order-broadcast/totalorderbroadcast.py, but the observations only cover lines 0–200). However, the surrounding infrastructure and test usage give us enough to explain *why* this design exists. Let me also note what's missing.
total-order-broadcast/totalorderbroadcast.py:LinearizableRegister — Read the full class to see exactly how reads and writes are both routed through TOB slotstotal-order-broadcast/totalorderbroadcast.py:TOBNode.deliverdecided_slots — How decided consensus slots are applied in order; the mechanism that makes both reads and writes see a consistent historyraft-consensus/raft.py:RaftNode.advancecommit_index — The commit advancement logic that would underpin a ReadIndex optimization in Rafttotal-order-broadcast/testtotalorder_broadcast.py — The linearizability tests likely demonstrate the read-after-write guarantees and possibly partition behaviorread-index-vs-lease — Compare the ReadIndex approach (majority heartbeat confirmation) with leader leases (clock-bounded) as read optimizations, and why Spanner chose the lease path with TrueTimelinearizable-read-requires-consensus — LinearizableRegister.read() broadcasts through the TOB consensus layer rather than reading local state, because a node cannot distinguish "I have the latest value" from "I'm partitioned and stale" without majority confirmationtob-uses-single-decree-paxos-per-slot — Each slot in the total order broadcast is decided by an independent ConsensusInstance running single-decree Paxos with prepare/accept phases (totalorderbroadcast.py:3)no-leader-lease-in-codebase — Neither the Raft nor TOB implementations include leader lease or ReadIndex optimizations; all operations pay full consensus costreads-and-writes-same-consensus-path — LinearizableRegister routes both reads and writes through the same TOB slot mechanism, giving them positions in the same total order