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.
§Runtime integration
Public mutation surfaces call RedDBRuntime::enforce_commit_policy
after successful writes. That runtime method maps ack_n to this
waiter and decides whether a timeout is soft telemetry or a hard
client-visible failure based on RED_COMMIT_FAIL_ON_TIMEOUT.
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.