Scenario 12.1.6 · Nisshi: PostgreSQL unavailable
Nisshi diskless Kafka: when PostgreSQL goes down
Nisshi 0.8.2 on PostgreSQL · while PostgreSQL is down produce gets KAFKA_STORAGE_ERROR, fetches close the connection and offset commits get COORDINATOR_NOT_AVAILABLE; when it is back, nothing is lost and no offset is skipped.
Run this scenario in the playgroundSteady traffic on PostgreSQL. t+0.766s
p1 writes orders-0 at 100 and orders-1 at 700; each is one transaction, committed and acked (166, 766). c1 reads through broker-2 every 600 ms.
Open at this step: step 1, Steady traffic on PostgreSQLPostgreSQL stops. t+1.000s
PostgreSQL holds the records, the watermarks, the group state and the offsets. The simulator notices the outage at once.
Open at this step: step 2, PostgreSQL stopsc1's fetches close the connection; its commit gets COORDINATOR_NOT_AVAILABLE. t+1.200s
At c1's 1200 poll broker-2 cannot read the rows, so it closes the connection, as Nisshi 0.8.2 does (shown as REQUEST_TIMED_OUT); c1 reconnects at its next poll. Its offset commit gets COORDINATOR_NOT_AVAILABLE.
Open at this step: step 3, c1's fetches close the connection; its commit gets COORDINATOR_NOT_AVAILABLEp1's produce gets KAFKA_STORAGE_ERROR. t+1.350s
p1's record for orders-2 reaches broker-1 at 1350. The transaction cannot run: nothing is stored and p1 gets KAFKA_STORAGE_ERROR, which is retriable. It retries every 400 ms, each failing the same way until PostgreSQL is back.
Open at this step: step 4, p1's produce gets KAFKA_STORAGE_ERRORPostgreSQL starts again. t+3.000s
Produce, fetch and offset commits work again.
Open at this step: step 5, PostgreSQL starts againp1's retry commits at offset 0: no gap. t+3.366s
p1's retry at 3350 commits orders-2 offset 0 and is acked at 3366. The failed transactions stored nothing, so there is no gap to skip.
Open at this step: step 6, p1's retry commits at offset 0: no gapc1 reads every record. t+3.600s
c1's 3600 poll reads the three records it could not read during the outage: orders-1 offset 0, orders-2 offset 0 and orders-0 offset 1 (written at 3500).
Open at this step: step 7, c1 reads every recordCaught up: the commit goes through. t+4.200s
c1's offset commit at 4200 succeeds: orders-0 at 2, orders-1 at 1, orders-2 at 1. Nothing acked was lost and no offset was skipped.
Open at this step: step 8, Caught up: the commit goes throughWhat you start with
PostgreSQL holds everything on Nisshi's production engine: records, watermarks, consumer group state and committed offsets. When it is unavailable no broker can serve a request that needs it, but a transaction either commits or stores nothing. p1 (idempotent, acks=all) writes through broker-1; consumer group g1 reads through broker-2 every 600 ms. PostgreSQL stops at 1000 and starts again at 3000.
Step by step
- Steady traffic on PostgreSQL t+0.766s p1 writes orders-0 at 100 and orders-1 at 700; each is one transaction, committed and acked (166, 766). c1 reads through broker-2 every 600 ms. Open at this step: step 1, Steady traffic on PostgreSQL
- PostgreSQL stops t+1.000s PostgreSQL holds the records, the watermarks, the group state and the offsets. The simulator notices the outage at once. Open at this step: step 2, PostgreSQL stops
- c1's fetches close the connection; its commit gets COORDINATOR_NOT_AVAILABLE t+1.200s At c1's 1200 poll broker-2 cannot read the rows, so it closes the connection, as Nisshi 0.8.2 does (shown as REQUEST_TIMED_OUT); c1 reconnects at its next poll. Its offset commit gets COORDINATOR_NOT_AVAILABLE. Open at this step: step 3, c1's fetches close the connection; its commit gets COORDINATOR_NOT_AVAILABLE
- p1's produce gets KAFKA_STORAGE_ERROR t+1.350s p1's record for orders-2 reaches broker-1 at 1350. The transaction cannot run: nothing is stored and p1 gets KAFKA_STORAGE_ERROR, which is retriable. It retries every 400 ms, each failing the same way until PostgreSQL is back. Open at this step: step 4, p1's produce gets KAFKA_STORAGE_ERROR
- PostgreSQL starts again t+3.000s Produce, fetch and offset commits work again. Open at this step: step 5, PostgreSQL starts again
- p1's retry commits at offset 0: no gap t+3.366s p1's retry at 3350 commits orders-2 offset 0 and is acked at 3366. The failed transactions stored nothing, so there is no gap to skip. Open at this step: step 6, p1's retry commits at offset 0: no gap
- c1 reads every record t+3.600s c1's 3600 poll reads the three records it could not read during the outage: orders-1 offset 0, orders-2 offset 0 and orders-0 offset 1 (written at 3500). Open at this step: step 7, c1 reads every record
- Caught up: the commit goes through t+4.200s c1's offset commit at 4200 succeeds: orders-0 at 2, orders-1 at 1, orders-2 at 1. Nothing acked was lost and no offset was skipped. Open at this step: step 8, Caught up: the commit goes through
The takeaway
While PostgreSQL was down, produce got KAFKA_STORAGE_ERROR (retriable) and the producer retried, fetches made the broker close the connection and the consumer reconnected, and offset commits got COORDINATOR_NOT_AVAILABLE. When it came back the next retry committed and the consumer read every record. A failed transaction stores nothing, so there was no gap and nothing acked was lost. Simulator choices: the outage noticed at once, REQUEST_TIMED_OUT standing for the closed connection, the 15 ms transaction borrowed from Inkless's figure, and the 400 ms retry backoff.
Configs in this scenario
-
acksHow many replicas must have a write before the producer counts it as sent: 0 (none), 1 (the leader only) or all (every in-sync replica, the default, and required for idempotence). How acks works
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=12.1.6" title="Kafka Simulator: Nisshi: PostgreSQL unavailable" 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/nisshi-postgresql-unavailable/">Nisshi diskless Kafka: when PostgreSQL goes down</a></p> Further reading
Nisshi v0.8.2 source on GitHub
Troubleshooting
- TimeoutException in Kafka producers: causes and fixes
- KAFKA_STORAGE_ERROR in Kafka: disk failures and Inkless
- COORDINATOR_NOT_AVAILABLE in Kafka: causes and fixes
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
- 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: 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