Scenario 11.1.5 · Redpanda: exactly-once on Cloud Topics
Redpanda Kafka transactions: exactly-once on Cloud Topics
Redpanda v26.2.2 Cloud Topics · a transactional producer commits one transaction on two partitions and aborts the next; the data goes through L0 objects and placeholders, read_committed reads only the committed records, and the reconciler leaves the aborted ones out of L1.
Run this scenario in the playgroundA transaction writes to two partitions; data goes through L0. t+1.350s
tx began a transaction at 100 ms and sent order-1 and order-2 at 200 ms, to orders-1 and orders-4, both led by broker-2. Both records went into broker-2's L0 buffer and one L0 object, l0-0001, which uploaded to S3 from 750 to 1350 ms. Only now are the placeholders appended to the two Raft logs, at offset 0, and the transaction is open from there: the LSO of both partitions stays at 0. tx asked to commit at 900 ms, during the upload; the commit is still waiting for its records to be acked.
Open at this step: step 1, A transaction writes to two partitions; data goes through L0Commit waits for the records to be acked; the markers need no upload. t+1.700s
The placeholders reached the followers at 1650 ms: a majority holds offset 0 on both partitions, the high watermark moved to 1 and tx got both acks. From 1650 to 1700 ms the high watermark was 1 and the LSO still 0. The commit, waiting since 900 ms, ended at 1700 ms, the simulator's next 50 ms check after the acks, and the LSO moved to 1 on both partitions. Redpanda appends the commit markers to each partition's Raft log as they are, with no L0 object; the simulator draws them as in every simulator transaction, without an offset, so the high watermark stays at 1.
Open at this step: step 2, Commit waits for the records to be acked; the markers need no uploadread_committed sees the committed records. t+1.800s
c-rc polled at 1800 ms and read order-1 and order-2, offset 0 of each partition, from broker-2's batch cache, filled when the placeholders were appended. Its read stops at the LSO, 1. tx began its second transaction at 1750 ms: order-3 and order-4 now sit in broker-2's L0 buffer, bound for L0 object l0-0002, with no offset yet.
Open at this step: step 3, read_committed sees the committed recordsThe next transaction is aborted. t+3.600s
l0-0002 uploaded from 2300 to 2900 ms; the placeholders took offset 1 on both partitions and were acked at 3200 ms. tx asked to abort at 2700 ms, during the upload: like the commit, the abort waited for the records already in L0 to be acked, and it ended at 3250 ms. Offset 1 of both partitions is now an aborted range and the LSO moved to 2. c-rc's poll at 3600 ms stepped its position over offset 1, returned no record and read no object. On Redpanda the abort markers go into the Raft logs too; in the simulator they take no offset.
Open at this step: step 4, The next transaction is abortedAfter reconciliation the L1 object holds no aborted records. t+3.990s
broker-2's reconciler run started at 3350 ms, 2 s after the first placeholder and after the abort, so the LSO was already 2. It took offsets 0 and 1 of both partitions and at 3990 ms registered L1 object l1-0001: order-1 and order-2 are in it, the aborted order-3 and order-4 at offset 1 are left out. The LRO of both partitions moved to 1, covering the aborted offset. l0-0002 still holds the aborted records in S3 until L0 garbage collection, which needs 12 h.
Open at this step: step 5, After reconciliation the L1 object holds no aborted recordsWhat you start with
Redpanda Cloud Topics keep each partition's Raft log, and transactions and idempotence ride on it: the partition checks the producer id, epoch and sequence on each placeholder, and commit and abort markers go into the Raft log as they are, with no upload. So exactly-once works on data that lives in S3. Producer tx (transactional.id tx-app, az-a) writes order-1 to orders-1 and order-2 to orders-4, both led by broker-2 in az-b, and commits; then it writes order-3 and order-4 and aborts. Group g-rc (az-b) reads with isolation.level=read_committed. The same commit and abort on classic Kafka is scenario 04.2.1. Timings are slowed so each phase gets its own frame.
Step by step
- A transaction writes to two partitions; data goes through L0 t+1.350s tx began a transaction at 100 ms and sent order-1 and order-2 at 200 ms, to orders-1 and orders-4, both led by broker-2. Both records went into broker-2's L0 buffer and one L0 object, l0-0001, which uploaded to S3 from 750 to 1350 ms. Only now are the placeholders appended to the two Raft logs, at offset 0, and the transaction is open from there: the LSO of both partitions stays at 0. tx asked to commit at 900 ms, during the upload; the commit is still waiting for its records to be acked. Open at this step: step 1, A transaction writes to two partitions; data goes through L0
- Commit waits for the records to be acked; the markers need no upload t+1.700s The placeholders reached the followers at 1650 ms: a majority holds offset 0 on both partitions, the high watermark moved to 1 and tx got both acks. From 1650 to 1700 ms the high watermark was 1 and the LSO still 0. The commit, waiting since 900 ms, ended at 1700 ms, the simulator's next 50 ms check after the acks, and the LSO moved to 1 on both partitions. Redpanda appends the commit markers to each partition's Raft log as they are, with no L0 object; the simulator draws them as in every simulator transaction, without an offset, so the high watermark stays at 1. Open at this step: step 2, Commit waits for the records to be acked; the markers need no upload
- read_committed sees the committed records t+1.800s c-rc polled at 1800 ms and read order-1 and order-2, offset 0 of each partition, from broker-2's batch cache, filled when the placeholders were appended. Its read stops at the LSO, 1. tx began its second transaction at 1750 ms: order-3 and order-4 now sit in broker-2's L0 buffer, bound for L0 object l0-0002, with no offset yet. Open at this step: step 3, read_committed sees the committed records
- The next transaction is aborted t+3.600s l0-0002 uploaded from 2300 to 2900 ms; the placeholders took offset 1 on both partitions and were acked at 3200 ms. tx asked to abort at 2700 ms, during the upload: like the commit, the abort waited for the records already in L0 to be acked, and it ended at 3250 ms. Offset 1 of both partitions is now an aborted range and the LSO moved to 2. c-rc's poll at 3600 ms stepped its position over offset 1, returned no record and read no object. On Redpanda the abort markers go into the Raft logs too; in the simulator they take no offset. Open at this step: step 4, The next transaction is aborted
- After reconciliation the L1 object holds no aborted records t+3.990s broker-2's reconciler run started at 3350 ms, 2 s after the first placeholder and after the abort, so the LSO was already 2. It took offsets 0 and 1 of both partitions and at 3990 ms registered L1 object l1-0001: order-1 and order-2 are in it, the aborted order-3 and order-4 at offset 1 are left out. The LRO of both partitions moved to 1, covering the aborted offset. l0-0002 still holds the aborted records in S3 until L0 garbage collection, which needs 12 h. Open at this step: step 5, After reconciliation the L1 object holds no aborted records
The takeaway
tx's first transaction put order-1 and order-2 into L0 object l0-0001; they got offset 0 only when their placeholders were appended, and the commit, asked for during the upload, waited until both were acked before the LSO moved past them, so g-rc read them. The second transaction's records went the same way through l0-0002, and the abort marked offset 1 aborted: g-rc stepped over it without reading an object, and broker-2's reconciler wrote L1 object l1-0001 with only the committed records, moving the LRO to 1, covering the aborted offset. Redpanda v26.2.2 facts: transactions and idempotence ride on the partition's Raft log, so they work on data in S3; the partition checks the producer id, epoch and sequence on each placeholder; commit and abort markers go into the Raft log as they are, with no upload; the reconciler reads from the LRO + 1 to the last stable offset through a read_committed reader, so aborted records are left out of L1; and an L0 object is deleted only once it is reconciled and at least 12 h old, so l0-0002 still holds the aborted records in S3 at the end. Simulator choices: the commit and the abort wait for the transaction's records to be acked and check every 50 ms, so each ended 50 ms after its acks; then the simulator's classic marker model applies: the markers take no offset, while Redpanda writes them to the Raft log with offsets, so on Redpanda order-3 and order-4 would sit after the commit marker; the transaction coordinator is drawn as classic Kafka's; the reconciler runs every 2 s (Redpanda adapts the interval between 250 ms and 10 s), so its first run, 2 s after the first placeholder, came after the abort and one L1 object covers both transactions; the new LRO takes effect in the tick the L1 object is registered; and the buffer interval, the upload and the L1 registration are slowed to 500 ms, 600 ms and 40 ms.
Configs in this scenario
-
transactional.A stable name that turns on transactions for a producer (and implies idempotence); a new producer that calls initTransactions() with the same id fences the older one.id -
isolation.read_uncommitted (the default) returns every record, including those of open and aborted transactions; read_committed returns only committed transactional records and stops at the last stable offset. How isolation.level workslevel
Embed this scenario
Paste this into a blog post, a course page or your team's docs. The scenario plays inside your page, and the link under it points readers to this walkthrough.
<iframe src="https://monedula.dev/kafka-simulator/embed/?scenario=11.1.5" title="Kafka Simulator: Redpanda: exactly-once on Cloud Topics" width="100%" height="520" style="border:1px solid #d0d0d0;border-radius:8px" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
<p><a href="https://monedula.dev/kafka-simulator/scenarios/redpanda-exactly-once-cloud-topics/">Redpanda Kafka transactions: exactly-once on Cloud Topics</a></p> Further reading
Redpanda v26.2.2 source on GitHub
More in Diskless
- Diskless Kafka topics (KIP-1163): the write path
- Diskless vs classic Kafka: cross-AZ replication traffic
- Diskless Kafka produce latency: the price of object storage
- Diskless Kafka (KIP-1163): when object storage goes down
- Aiven Inkless diskless Kafka: the write path
- Aiven Inkless: what a PostgreSQL outage does to Kafka
- Aiven Inkless: what losing a Kafka broker costs
- Aiven Inkless: a slow S3 bucket fails Kafka produce
- KafScale diskless Kafka: etcd lease, S3 segment, ack
- KafScale 2.1 diskless Kafka: a lease owner crashes
- KafScale 2.1 diskless Kafka: when etcd goes down
- KafScale 2.1 diskless Kafka: when S3 goes down
- KafScale 2.1 proxy: etcd down past the 60 s cache TTL
- KafScale 2.1: a Kafka producer timeout that still wrote
- KafScale 2.1 diskless Kafka: lease handover, no overwrite
- KafScale 2.1 diskless Kafka: a paused broker comes back
- AutoMQ diskless Kafka: one S3 WAL per broker, then ack
- AutoMQ diskless Kafka: a broker crash and WAL failover
- AutoMQ diskless Kafka: moving a partition, no copying
- AutoMQ diskless Kafka: zone router, no cross-zone data
- AutoMQ diskless Kafka: when S3 goes down
- WarpStream diskless Kafka: the write path through Agents
- WarpStream Kafka: a leader per client, a cache per zone
- WarpStream Kafka: an Agent dies mid-commit
- WarpStream Kafka: the control plane goes down
- WarpStream Kafka Ripcord: produce without the control plane
- WarpStream Kafka lightning topics: ack before the commit
- WarpStream Kafka transactions in the control plane
- Redpanda Kafka write path: the offset comes after S3
- Redpanda Kafka leader crash: a Raft election, no replay
- Redpanda Kafka S3 outage: uploads time out, Raft holds
- Redpanda Kafka L0 to L1: the LRO and who serves a read
- Nisshi diskless Kafka: watermark.json, then the batch
- Nisshi diskless Kafka on PostgreSQL: a row lock per write
- Nisshi diskless Kafka: two brokers write one partition
- Nisshi diskless Kafka: reading through another broker
- Nisshi diskless Kafka: a broker dies mid-write
- Nisshi diskless Kafka: when PostgreSQL goes down
- Nisshi diskless Kafka: what 0.8.2 refuses
- Ursa for Kafka write path: Oxia assigns the offset
- Ursa for Kafka zones: the zonal owner and the zone cache
- Ursa for Kafka compaction: from WAL objects to Parquet
- Ursa for Kafka broker failure: a kill and a silent broker
- Ursa for Kafka: diskless and disk topics, side by side