Skip to main content
Source baselineNereuscommit c820391dc1de·verified 2026-08-07·authority reader-facing-summary

Example: Kafka transaction and DeleteRecords

This example keeps Kafka’s protocol state separate from Nereus’s committed bytes.

Initial state

FactValue
Topic ID / partitionT1 / 0
Binding streamS-kafka-1
logStartOffset0
Stable end / HW / LSO100 / 100 / 100
RequestOpen transaction, one RecordBatch with four records

Produce and transaction visibility

  1. KRaft confirms the current leader epoch.
  2. Kafka validates producer ID, epoch, sequence, and transaction state.
  3. Kafka assigns base offset 100.
  4. The adapter stores the complete RecordBatch as one ranged entry with recordCount=4 and range [100,104).
  5. Nereus WAL and head commit; stable end becomes 104.
  6. Kafka records the open transaction in ProducerStateManager.
  7. HW may advance to 104, while LSO remains 100.
  8. Produce completes.

READ_UNCOMMITTED can read within HW. READ_COMMITTED cannot expose the open transaction until the Kafka commit marker and transaction state advance LSO. Nereus supplies stable bytes/range; Kafka decides transaction visibility.

Broker takeover

The new leader obtains a higher KRaft epoch and Nereus append authority, hydrates an NKC1 checkpoint, replays its covered tail to the current head, and rebuilds producer/transaction/virtual-segment state. The old leader’s later head CAS is fenced. Any physical bytes it wrote without a commit do not advance LEO.

DeleteRecords to offset 60

  1. Kafka retention publishes an NKC1 checkpoint covering the pre-trim state.
  2. Nereus advances logical trim to 60.
  3. Binding and local log start become 60.
  4. Fetch below 60 returns Kafka out-of-range/trim semantics.
  5. Objects and ledgers remain until source retirement and physical GC.

If the Broker is killed after trim, a new Broker reloads head, trim, and checkpoint. Retrying target 60 does not publish a second checkpoint or modify the head again.

Source anchors