Skip to main content

Module engine_journal_batcher

Module engine_journal_batcher 

Source
Expand description

WAL-first journal batcher for durable ACKs in the engine hot path.

The engine pushes JournalEntry values into a bounded channel. This task drains entries, appends them to a local WAL, calls fdatasync, and only then allows ACK/event emission via commit_ack.

PostgreSQL replication runs asynchronously after WAL durability so client-visible latency is decoupled from network/database I/O.

Modulesยง

rsm_block_persistence ๐Ÿ”’

Structsยง

EngineJournalBatcher
The batcher that runs in the background and appends to local WAL first, then replicates to PostgreSQL asynchronously.
EventPayload
Pre-serialized event payload ready for DB storage. Contains wire-format bytes (version byte + msgpack) so no further serialization is needed.
JournalBatcherConfig
Configuration for the journal batcher
JournalCashWithdrawalSideEffect
Journal-only side effect for a CashWithdrawalUpdate command.
JournalEntry
A journal entry to be batched and durably appended.
JournalFillSideEffect
Journal-only accounting deltas for a single OrderFilled event.
PreparedWalBlock ๐Ÿ”’
ReplicationProgress ๐Ÿ”’
RsmBatchRoots ๐Ÿ”’
RsmWalWriterState ๐Ÿ”’
WalBlockRecordWithRoots ๐Ÿ”’
WalDurableBlockEntry ๐Ÿ”’
WalJournalRecord ๐Ÿ”’
WalRecordWithOffset ๐Ÿ”’
WalState ๐Ÿ”’

Enumsยง

JournalMessage
Messages sent to the journal batcher.
ReplicationMessage ๐Ÿ”’
WalWriterMessage ๐Ÿ”’
Messages sent from the batcher task to the dedicated WAL writer thread.

Constantsยง

DEFAULT_CHANNEL_CAPACITY
Default channel capacity
REPLICATION_RETRY_DELAY ๐Ÿ”’
WAL_PREALLOC_CHUNK ๐Ÿ”’
Pre-allocate WAL file in 64 MiB chunks to avoid extent allocation stalls.

Functionsยง

append_command_delta ๐Ÿ”’
append_intent_delta ๐Ÿ”’
append_obligation_delta ๐Ÿ”’
apply_recovered_rsm_commitment_blocks ๐Ÿ”’
engine_command_identity_hashes ๐Ÿ”’
engine_journal_entry_insert ๐Ÿ”’
next_replication_chunk_len ๐Ÿ”’
Returns the number of records for the next replication chunk.
rsm_batch_roots_from_wal ๐Ÿ”’
rsm_event_payload_hash ๐Ÿ”’
rsm_global_leaf ๐Ÿ”’
rsm_hash_with_domain ๐Ÿ”’
rsm_state_delta_from_entries ๐Ÿ”’
rsm_state_delta_from_parts ๐Ÿ”’
rsm_state_supported_command ๐Ÿ”’
should_defer_replay_record ๐Ÿ”’
wal_fsync_io_uring ๐Ÿ”’
Submit IORING_OP_FSYNC with DATASYNC flag via io_uring.
wal_writer_thread_main ๐Ÿ”’
Dedicated WAL writer OS thread.

Type Aliasesยง

JournalBatchSender
Sender half for pushing journal entries
SharedJournalBatchSender
Shared sender that can be cloned and used from the engine.
WalBlockEntry ๐Ÿ”’
WalBlockRecord ๐Ÿ”’