[
https://issues.apache.org/jira/browse/KAFKA-8451?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
wenxuanguan updated KAFKA-8451:
-------------------------------
Description:
It's common in distributed system that multiple producer instances send message
in one transaction concurrently, and the transaction is committed when all the
producer send message successfully. Otherwise, if one producer failed, the
transaction is aborted and no message will be consumed.
However, when multiple producer share the same txn id, throw the following
exception:
org.apache.kafka.common.KafkaException: Cannot execute transactional method
because we are in an error state
at
org.apache.kafka.clients.producer.internals.TransactionManager.maybeFailWithError(TransactionManager.java:784)
at
org.apache.kafka.clients.producer.internals.TransactionManager.beginTransaction(TransactionManager.java:215)
at
org.apache.kafka.clients.producer.KafkaProducer.beginTransaction(KafkaProducer.java:606)
at
com.matt.test.kafka.producer.ProducerTransactionExample.main(ProducerTransactionExample.java:68)
Caused by: org.apache.kafka.common.errors.ProducerFencedException: Producer
attempted an operation with an old epoch. Either there is a newer producer with
the same transactionalId, or the producer's transaction has been expired by the
broker.
was:
It's common in distributed system that multiple producer instances send message
in one transaction concurrently, and if one producer failed, the other producer
abort transaction.
However, when multiple producer share the same txn id, throw the following
exception:
org.apache.kafka.common.KafkaException: Cannot execute transactional method
because we are in an error state
at
org.apache.kafka.clients.producer.internals.TransactionManager.maybeFailWithError(TransactionManager.java:784)
at
org.apache.kafka.clients.producer.internals.TransactionManager.beginTransaction(TransactionManager.java:215)
at
org.apache.kafka.clients.producer.KafkaProducer.beginTransaction(KafkaProducer.java:606)
at
com.matt.test.kafka.producer.ProducerTransactionExample.main(ProducerTransactionExample.java:68)
Caused by: org.apache.kafka.common.errors.ProducerFencedException: Producer
attempted an operation with an old epoch. Either there is a newer producer with
the same transactionalId, or the producer's transaction has been expired by the
broker.
> transaction support multiple producer instance
> ----------------------------------------------
>
> Key: KAFKA-8451
> URL: https://issues.apache.org/jira/browse/KAFKA-8451
> Project: Kafka
> Issue Type: Bug
> Reporter: wenxuanguan
> Priority: Major
>
> It's common in distributed system that multiple producer instances send
> message in one transaction concurrently, and the transaction is committed
> when all the producer send message successfully. Otherwise, if one producer
> failed, the transaction is aborted and no message will be consumed.
> However, when multiple producer share the same txn id, throw the following
> exception:
> org.apache.kafka.common.KafkaException: Cannot execute transactional method
> because we are in an error state
> at
> org.apache.kafka.clients.producer.internals.TransactionManager.maybeFailWithError(TransactionManager.java:784)
> at
> org.apache.kafka.clients.producer.internals.TransactionManager.beginTransaction(TransactionManager.java:215)
> at
> org.apache.kafka.clients.producer.KafkaProducer.beginTransaction(KafkaProducer.java:606)
> at
> com.matt.test.kafka.producer.ProducerTransactionExample.main(ProducerTransactionExample.java:68)
> Caused by: org.apache.kafka.common.errors.ProducerFencedException: Producer
> attempted an operation with an old epoch. Either there is a newer producer
> with the same transactionalId, or the producer's transaction has been expired
> by the broker.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)