[ https://issues.apache.org/jira/browse/KAFKA-8483?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16856234#comment-16856234 ]
ASF GitHub Bot commented on KAFKA-8483: --------------------------------------- hachikuji commented on pull request #6883: KAFKA-8483; Ensure message ordering is preserved after sequence resets URL: https://github.com/apache/kafka/pull/6883 The idempotent producer attempts to detect spurious UNKNOWN_PRODUCER_ID errors and handle them by reassigning sequence numbers to the inflight batches. The inflight batches are tracked in a PriorityQueue. The problem is that the reassignment of sequence numbers depends on the iteration order of PriorityQueue, which does not guarantee any ordering. So this can result in sequence numbers being assigned in the wrong order. This patch fixes the problem by using a sorted set instead of a priority queue so that the iteration order preserves the sequence order. Note that resetting sequence numbers is an exceptional case. ### Committer Checklist (excluded from commit message) - [ ] Verify design and implementation - [ ] Verify test coverage and CI build status - [ ] Verify documentation (including upgrade notes) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Possible reordering of messages by producer after UNKNOWN_PRODUCER_ID error > --------------------------------------------------------------------------- > > Key: KAFKA-8483 > URL: https://issues.apache.org/jira/browse/KAFKA-8483 > Project: Kafka > Issue Type: Bug > Reporter: Jason Gustafson > Assignee: Jason Gustafson > Priority: Major > > The idempotent producer attempts to detect spurious UNKNOWN_PRODUCER_ID > errors and handle them by reassigning sequence numbers to the inflight > batches. The inflight batches are tracked in a PriorityQueue. The problem is > that the reassignment of sequence numbers depends on the iteration order of > PriorityQueue, which does not guarantee any ordering. So this can result in > sequence numbers being assigned in the wrong order. -- This message was sent by Atlassian JIRA (v7.6.3#76005)