Two Writes, One Crash

A checkout service commits the orders row to Postgres and then publishes an OrderPlaced message to Kafka in the same request handler. About one request in ten thousand leaves a committed row with no message, because the pod is killed between the two calls. What is this failure, and why won't better error handling remove it?

A

A partition rebalance: Kafka moved partition leadership mid-publish and the producer client discarded the record instead of retrying against the new leader

B

The dual write problem: the commit and the publish are two independent operations, so no retry or catch block can make them succeed or fail together

C

A producer misconfiguration: with acks=all and the idempotent producer enabled, the broker joins the database transaction so the row and the message commit together

D

An isolation anomaly: raising the database transaction to SERIALIZABLE extends its atomicity across the broker call, so the row stays invisible until the publish returns