Transactional Producer send msg always got ErrOutOfOrderSequenceNumber error when brokers reconnected #2611
Labels
needs-investigation
Issues that require followup from maintainers
stale
Issues and pull requests without any recent activity
Versions
Please specify real version numbers or git SHAs, not just "Latest" since that changes fairly regularly.
Configuration
What configuration values are you using for Sarama and Kafka?
Logs
When filing an issue please provide logs from Sarama and Kafka if at all
possible. You can set
sarama.Logger
to alog.Logger
to capture Sarama debugoutput.
logs: CLICK ME
Problem Description
hi, I am using the transactional api in a sync-send-multi-messages-in-txn scenario, but I found an unexpected case when the network not connectable.
The code like this:
When brokers die, all messages-sending-call will return error ErrOutOfOrderSequenceNumber (45), until I recreate a sync producer. The case looks like this problem #1430, and this is a fix for the problem : #1661.
I look at this commit ba2b4bc and I found maybe this line of code is the reason for ErrOutOfOrderSequenceNumber.
!p.IsTransactional() && msg.hasSequence will bump epoch only when non-transactional. But I write a similar code of Java to send messages using Kafka Java SDK, and ErrOutOfOrderSequenceNumber will not happen after the brokers reconnect.
I found a log printed by Kafak Java SDK:
I think this log means that no matter transaction is enabled, kafka will always bump the epoch after messages sent fail, but in sarama, only idempotent enabled and not transaction enabled will bump the epoch.
Is this a bug in sarama ? Could we fix this by removing the transaction predicate in if !p.IsTransactional() && msg.hasSequence condition.
The text was updated successfully, but these errors were encountered: