Monedula
Kafka guide contents

Markdown

Part VI · Reference

Kafka Improvement Proposal

KIP-890: the broker defends transactions, transaction version 2

Producers and transactions · Shipped · since Kafka 3.6 · status checked November 2026

KIP-890 made the broker check transactional writes instead of trusting the producer. Part one (Kafka 3.6) rejects a write to a partition that was never added to the transaction, which caused hanging transactions. Part two (Kafka 4.0) bumps the producer epoch on every commit and abort, so a late write from an earlier transaction can no longer land in the next one.

Proposal
KIP-890, Transactions Server-Side Defense
Status
Shipped Part 1 in Kafka 3.6 (2023), part 2 in Kafka 4.0 (2025) as transaction.version 2.
Area
Producers and transactions
zombie fenced. tx-zombie (epoch 0) tries to open a new transaction, but tx holds a newer epoch, so the zombie is FENCED and can never write duplicates. In Kafka the fence lands on its first send or commit, since beginTransaction() is client-side, and transaction.version=2 bumps the epoch at every commit. Open this step in the full playground

Why it was needed

A hanging transaction is one the coordinator thinks is finished while a partition still holds its open records. It pins the last stable offset, so read_committed consumers stop and compaction cannot clean past it, until someone aborts it by hand. The usual cause was a retried or delayed produce request arriving after the client had moved on.

What it changes

With part one the leader asks the transaction coordinator to verify that the partition is in the ongoing transaction before it appends, so a stray write is refused. Part two, the new transaction protocol, adds partitions to the transaction implicitly on the server and bumps the producer epoch at the end of each transaction, which fences any request still in flight from the previous one. Older clients that break the rules get INVALID_TXN_STATE.

How to use it

  • Part one is on by default (transaction.partition.verification.enable=true) on brokers from 3.6; use 3.6.1 or newer, since 3.6.0 had a bug with compression.
  • Part two needs the transaction.version=2 feature, enabled when a cluster finishes its upgrade to 4.0, and producers on Kafka 4.0 or newer clients.

Where it stands

Part one shipped in Kafka 3.6 for data partitions and was extended to consumer-offset partitions in 3.7. Part two completed in Kafka 4.0 and is the default for clusters that finished upgrading to 4.0; producers switch to it at their next transaction, without a restart.

What comes next

Follow-up KIPs refine error handling, such as KIP-1050 with a TransactionAbortableException, and Kafka 4.2 carried the transaction version into transaction markers (KIP-1228). Two-phase commit with external systems is a separate proposal.

See it in the simulator

Sources

All Kafka KIPs