Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Commits would be added to the chain of pending commits based only on the rebalancing state. Given that the rebalancing state is updated (via `ConsumerRebalanceListener.onPartitionsAssigned`) separate from when pending commits are processed (after `poll`), it could happen that commits emitted later would be processed before earlier pending ones. This updates the condition for queueing commits to take into account the prior existence of pending commits. In addition, the condition for processing pending commits in `poll` is also updated to disregard whether a rebalance operation was ongoing at the start of the poll. Instead, the existence of pending commits along with a non-`rebalancing` state are a sufficient trigger. This ensures that rebalance operations that might conclude within a single consumer poll do not leave behind any pending commits. At the moment, these possibilities are theoretical as commit operations are serialized via `KafkaConsumerActor`'s request queue, and don't happen concurrently to polls. That said, the cost of the fixes is trivial and being explicit about the conditions may prevent future bugs, if the surrounding context changes.
- Loading branch information