Expand description
Group commit with consolidation for WAL frame writes (bd-ncivz.3).
Amortizes fsync overhead across multiple concurrent transactions by
batching WAL frame writes into a single I/O + fsync operation.
§Consolidation Protocol
Writers submit sealed frame batches to a consolidation queue. The protocol transitions through three phases:
FILLING ──▶ FLUSHING ──▶ COMPLETE ──▶ FILLING (next epoch)- FILLING: Accepting new frame batches from writers.
- FLUSHING: The flusher (first writer to arrive) writes all accumulated frames to the WAL file via a single consolidated I/O, then fsyncs.
- COMPLETE: All waiters are notified; committed frames are durable.
The first writer to enter a FILLING phase becomes the flusher. Subsequent writers add their frames and park on a condvar. When the flusher decides to flush (batch full OR max delay exceeded), it writes all accumulated frames, fsyncs once, and wakes all parked writers.
§I/O Optimization
Consolidated writes serialize all frame buffers into a single contiguous
write to the WAL file, avoiding per-frame syscall overhead. The single
fsync after the batch write makes all frames durable atomically.
§Tuning
max_group_size: Maximum frames per group before forced flush (default: 64).max_group_delay: Maximum time to wait for additional writers before flushing (default: 1ms). Bounded to ensure tail latency.
Structs§
- Consolidation
Metrics - Atomic counters for group commit consolidation observability.
- Consolidation
Metrics Snapshot - Point-in-time snapshot of consolidation metrics.
- Frame
Submission - A single WAL frame submitted for consolidated writing.
- Group
Commit Config - Configuration for group commit consolidation.
- Group
Commit Consolidator - The group commit consolidator accumulates frame batches from concurrent writers and flushes them to the WAL file in consolidated groups.
- Phase
Histogram - Phase
Percentiles - Percentile snapshot from a
PhaseHistogram. - Transaction
Conflict Snapshot - WAL conflict horizon captured by a submitting transaction.
- Transaction
Frame Batch - A batch of frames from a single transaction, submitted atomically.
- Transaction
Frame Batch Context - Lane-local staging context attached to a transaction batch.
- Wake
Reason Counters - Tracks why a waiter woke up during epoch wait.
- Wake
Reason Snapshot - Point-in-time snapshot of wake reasons.
Enums§
- Consolidation
Phase - Phase of the consolidation protocol.
- Submit
Outcome - Outcome of submitting a transaction batch for consolidated writing.
Statics§
- GLOBAL_
CONSOLIDATION_ METRICS - Global consolidation metrics singleton.
Functions§
- commit_
phase_ timing_ enabled - Whether commit phase timing should sample
Instant::now(). - commit_
phase_ timing_ forced_ enabled - Whether commit phase timing has been explicitly enabled by a profiling caller.
- detailed_
consolidation_ metrics_ enabled - Whether expensive per-substep consolidation timing is enabled.
- set_
commit_ phase_ timing_ enabled - Enable or disable WAL commit phase timing for explicit profiling windows.
- write_
consolidated_ frames - Write a consolidated batch of frames to the WAL file.