Expand description
Group commit — batches concurrent WAL flushes into a single fsync.
§Model
Leader/follower group commit sitting at the WAL durability boundary
(StorageManager commit_transaction step 1). Each submitting thread:
- Appends its WAL records (including the
Commitrecord) under the WAL lock — without an fsync. - Enqueues a pending flush request tagged with the thread’s LSN.
- Tries to become the leader; the leader drains the queue for
GroupCommitConfig::drain_timeout, then performs a single fsync covering every drained request and delivers the shareddurable_batch_lsnback to each waiter. - Followers wait on their own result slot; if no leader finishes them
within
GroupCommitConfig::leader_timeout, they retry leadership (self-healing — e.g. a leader thread was descheduled).
The durability guarantee is preserved: a submitter only returns success after an fsync that started after it enqueued. Recovery format is untouched — this coordinates when an fsync happens, never what is written.
§Fsync target
GroupCommit is generic over WalLike; akar-storage implements it
for Mutex<WAL>, so a whole group shares the same underlying WAL file.
Structs§
- Group
Commit - Leader/follower group-commit coordinator over a shared
WalLiketarget. - Group
Commit Config - Group-commit configuration.
- Group
Commit Result - Result delivered to a submitter once its group is durable.
- Group
Commit Stats - Simple cumulative statistics for observability.
Constants§
- DEFAULT_
DRAIN_ TIMEOUT - Default time a leader keeps draining the queue before fsyncing.
- DEFAULT_
LEADER_ TIMEOUT - Default time a follower waits before it attempts to take over leadership.
Traits§
- WalLike
- A durable flush target that many commits can share.