Jason Gustafson created KAFKA-13782:
---------------------------------------

             Summary: Producer may fail to add the correct partition to 
transaction
                 Key: KAFKA-13782
                 URL: https://issues.apache.org/jira/browse/KAFKA-13782
             Project: Kafka
          Issue Type: Bug
            Reporter: Jason Gustafson
             Fix For: 3.2.0, 3.1.1


In KAFKA-13412, we changed the logic to add partitions to transactions in the 
producer. The intention was to ensure that the partition is added in 
`TransactionManager` before the record is appended to the `RecordAccumulator`. 
However, this does not take into account the possibility that the originally 
selected partition may be changed if `abortForNewBatch` is set in 
`RecordAppendResult` in the call to `RecordAccumulator.append`. When this 
happens, the partitioner can choose a different partition, which means that the 
`TransactionManager` would be tracking the wrong partition.

I think the consequence of this is that the batches sent to this partition 
would get stuck in the `RecordAccumulator` until they timed out because we 
validate before sending that the partition has been added correctly to the 
transaction.

Note that KAFKA-13412 has not been included in any release, so there are no 
affected versions.

Thanks to [~alivshits] for identifying the bug.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to