Expand description
Synchronous commit waiter (PLAN.md Phase 11.4 — ack_n).
Bridges the primary’s commit path with replica ACKs. The commit
caller picks a target_lsn (the LSN it just made durable
locally) and asks the waiter “block until at least N replicas
have ack’d this LSN, or the timeout expires.” Replica ACK RPCs
call record_replica_ack which signals every waiter whose
threshold is now met.
§Thread safety
The waiter uses a Mutex<State> + Condvar so the await_acks
call blocks the caller’s thread without spinning. Acks bump a
per-replica last_durable_lsn map and broadcast on the condvar.
Waiters wake, recompute the count of replicas at or past their
target, and either return Ok(count) or re-wait.
§Why this is just the foundation
The actual write commit path doesn’t yet call await_acks —
wiring it in touches every public mutation surface and changes
latency characteristics across the board. This module ships the
primitive + the ack registry so the wiring change can land as
one focused PR per surface (HTTP, gRPC, wire protocol) rather
than a single massive diff.
Structs§
- Commit
Waiter - Commit
Waiter Metrics - Outcome counters for /metrics. PLAN.md Phase 11.4 — operators
alert on
timed_outrising (commit policy is too tight or replicas are stalled) and watchlast_wait_microsfor the p95.