Scenario 08.2.5 · KafScale: a failed etcd write after a good upload
KafScale 2.1: a Kafka producer timeout that still wrote
KafScale 2.1 · etcd stops between the S3 upload and the etcd write: the producer gets REQUEST_TIMED_OUT, the segment stays in S3, the next restore adopts it, and the retry writes the record a second time.
Run this scenario in the playgroundorder-2 is uploading. t+1.360s
orders is a KafScale topic (KafScale 2.1) with one partition, owned by broker-2. order-1 was acked at 790 ms and c1 read it at 1000 ms. p1 sent order-2 at 1300 ms: broker-2 gave it offset 1 and started uploading segment orders/0/segment-00000001 at 1350 ms. After the upload, broker-2 writes the new end offset to etcd, and only then acks.
Open at this step: step 1, order-2 is uploadingetcd stops during the etcd write: not acked. t+1.995s
The upload landed at 1950 ms and the etcd write began; etcd stopped at 1970 ms and the write failed at 1990 ms. p1 got REQUEST_TIMED_OUT, not an ack: in KafScale the etcd write gates the ack. The segment stays in S3, marked failed; the end offset in etcd is still 1, so c1 cannot read it. broker-2 dropped the partition from memory: the next request for it restores first.
Open at this step: step 2, etcd stops during the etcd write: not ackedetcd is back. t+4.100s
While etcd was down, p1's retries at 2490, 2990, 3490 and 3990 ms got REQUEST_TIMED_OUT, and so did c1's offset commit and its fetches: broker-2 had dropped the partition from memory, and loading it again needs etcd. etcd started at 4000 ms. broker-2 still holds the lease, but has no next offset in memory for orders-0.
Open at this step: step 3, etcd is backThe retry restores and adopts the failed segment. t+4.500s
p1's retry at 4490 ms made broker-2 restore orders-0 before appending: etcd's end offset is 1, but S3 lists the failed segment, which ends at offset 1, so S3's end is 2. The restore adopts it and numbering goes on from 2: order-2 at offset 1 is now readable, although p1 was told it failed. The retry itself is a new record: offset 2, uploading.
Open at this step: step 4, The retry restores and adopts the failed segmentc1 reads order-2 twice. t+6.050s
c1 read offset 1, the first copy of order-2, at 5000 ms, from S3. The retry was acked at 5130 ms, and c1 read offset 2, the second copy, at 6000 ms. p1 sent two records and was acked for two; the partition holds three. KafScale has no idempotent producer, so nothing drops the duplicate. KafScale's maintainers confirmed this is intended: the segments in S3 are authoritative, and delivery is at-least-once.
Open at this step: step 5, c1 reads order-2 twiceWhat you start with
A KafScale produce request becomes one S3 segment, then the broker writes the partition's new end offset to etcd. The producer is acked only after that etcd write succeeds. If the write fails after a good upload, the producer gets an error, the segment stays in S3, and the broker drops the partition from memory, so the next request for it restores from etcd and S3 first. Here etcd stops during order-2's etcd write and starts again 2 s later. Producer p1 has idempotence off and is set to retries=30 and retry.backoff.ms=500. Watch the segment in the object storage lane, etcd, p1's errors and what c1 reads.
Step by step
- order-2 is uploading t+1.360s orders is a KafScale topic (KafScale 2.1) with one partition, owned by broker-2. order-1 was acked at 790 ms and c1 read it at 1000 ms. p1 sent order-2 at 1300 ms: broker-2 gave it offset 1 and started uploading segment orders/0/segment-00000001 at 1350 ms. After the upload, broker-2 writes the new end offset to etcd, and only then acks. Open at this step: step 1, order-2 is uploading
- etcd stops during the etcd write: not acked t+1.995s The upload landed at 1950 ms and the etcd write began; etcd stopped at 1970 ms and the write failed at 1990 ms. p1 got REQUEST_TIMED_OUT, not an ack: in KafScale the etcd write gates the ack. The segment stays in S3, marked failed; the end offset in etcd is still 1, so c1 cannot read it. broker-2 dropped the partition from memory: the next request for it restores first. Open at this step: step 2, etcd stops during the etcd write: not acked
- etcd is back t+4.100s While etcd was down, p1's retries at 2490, 2990, 3490 and 3990 ms got REQUEST_TIMED_OUT, and so did c1's offset commit and its fetches: broker-2 had dropped the partition from memory, and loading it again needs etcd. etcd started at 4000 ms. broker-2 still holds the lease, but has no next offset in memory for orders-0. Open at this step: step 3, etcd is back
- The retry restores and adopts the failed segment t+4.500s p1's retry at 4490 ms made broker-2 restore orders-0 before appending: etcd's end offset is 1, but S3 lists the failed segment, which ends at offset 1, so S3's end is 2. The restore adopts it and numbering goes on from 2: order-2 at offset 1 is now readable, although p1 was told it failed. The retry itself is a new record: offset 2, uploading. Open at this step: step 4, The retry restores and adopts the failed segment
- c1 reads order-2 twice t+6.050s c1 read offset 1, the first copy of order-2, at 5000 ms, from S3. The retry was acked at 5130 ms, and c1 read offset 2, the second copy, at 6000 ms. p1 sent two records and was acked for two; the partition holds three. KafScale has no idempotent producer, so nothing drops the duplicate. KafScale's maintainers confirmed this is intended: the segments in S3 are authoritative, and delivery is at-least-once. Open at this step: step 5, c1 reads order-2 twice
The takeaway
p1 was told the write failed, but the record was not gone. Its segment stayed in S3, and when etcd was back, p1's retry made broker-2 restore the partition: the restore found the segment, took it in and wrote its end offset to etcd, so order-2 became readable at offset 1. Then the retry wrote order-2 again, at offset 2, and was acked. c1 read order-2 twice. p1 runs with idempotence off. Since KafScale 2.1.0 an idempotent producer's retry gets offset 1 back instead, because the restore rebuilds its sequences from the segments in S3; without idempotence, KafScale's operations docs say a timeout does not prove that nothing was written: after a producer timeout, a record can reach consumers twice. KafScale's maintainers confirmed this is intended: the segments in S3 are authoritative, so a restore moves the end offset in etcd forward to match them, and delivery is at-least-once. Simulator choices: the etcd write fails when it would have ended (KafScale waits up to 3 s), the brokers notice the outage at once, and only the REQUEST_TIMED_OUT case is shown (other etcd server errors answer UNKNOWN_SERVER_ERROR and are not modelled).
Configs in this scenario
-
retriesHow many times the producer sends a batch again after a transient error (default 2147483647, so in practice delivery.timeout.ms ends the retrying); idempotence needs it above 0. -
retry.How long the producer waits before retrying a failed send, so it does not hammer a broker that is still recovering.backoff. ms
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=08.2.5" title="Kafka Simulator: KafScale: a failed etcd write after a good upload" 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/kafscale-2-failed-etcd-write/">KafScale 2.1: a Kafka producer timeout that still wrote</a></p> Further reading
KafScale v2.1.0 source on GitHub
Troubleshooting
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 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
- Redpanda Kafka transactions: exactly-once on Cloud Topics
- 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