Skip to content
Kafka Is FunProgress

AdvancedInternals Deep Dive

What is the epoch fencing mechanism in Kafka transactions?

Reference answer

When a transactional producer with a given transactional.id connects to the Transaction Coordinator, the coordinator bumps the producer epoch for that transactional.id. If an old zombie producer (lower epoch) tries to commit a transaction, the coordinator rejects it — the higher-epoch producer has 'fenced' the zombie. This solves the zombie producer problem: after a producer restart, the old process may still have in-flight transactions. The new epoch invalidates those transactions atomically. Brokers also validate PID+epoch on every write, rejecting lower-epoch writes.

Expected key concepts: transactional.id, producer epoch, Transaction Coordinator, zombie producer, fencing, lower epoch, rejected, atomically, PID, in-flight transactions