Serwios opened a new pull request, #17977: URL: https://github.com/apache/kafka/pull/17977
Adjustments for Round Robing partitioner and fix of Round Robing uneven distribution after KIP-480 () * Fixed KIP-480: Issue was multiple partition() calls for the same record causing uneven distribution. Resolved by decrementing the counter in onNewBatch. * Added partition reuse: Implemented topicLastPartitionMap to reuse the last assigned partition, reducing counter increments. * Thread-safe counter management: Used ConcurrentMap and AtomicInteger to prevent race conditions in multi-threaded environments. * Optimized and modular partition logic: Moved logic to roundRobinPartition for better readability and maintainability. * Graceful handling of edge cases: Added checks for empty partitions, ensuring stable behavior. * Separation of concerns: Split responsibilities across partition(), onNewBatch(), and helper methods for cleaner, extensible code. Tests: ### Committer Checklist (excluded from commit message) - [X] 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
