Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use maximal offset when committing transaction in TransactionalProduc…
…erStage Callbacks from `producer.send` are guaranteed to execute in order only for a single output partition. That means we can have a race condition where we execute a callback for input record with offset 1 before executing a callback for input record with offset 0. That causes `NonEmptyTransactionBatch` to contain offset 0, when committing transaction. That leads to data duplication. This fix ensures that we only increase the offsets stored in `TransactionBatch`. Since having all consecutive offsets wrote to Kafka is guaranteed by `awaitingConfirmation == 0`, we can only keep the maximal offset in the `TransactionBatch`.
- Loading branch information