jack2012aa opened a new pull request, #20982:
URL: https://github.com/apache/kafka/pull/20982

   # Description
   This PR fixes the flakiness in `testRackAwareRangeAssignor`.  Currently, it 
fails during the verification after `alterPartitionReassignments`, and also 
during `groupProtocol = consumer`.
   
   The test relies on auto-commit, which is not deterministic during the 
rebalance triggered by `alterPartitionReassignments`. Consequently, the 
consumer may fail to commit offsets before the rebalance completes. When the 
partition is re-assigned, the consumer fetches previously consumed messages 
(duplicate consumption). Since `verifyAssignments` polls for a fixed number of 
records, these duplicate messages cause the assertion to fail (as it expects 
records from specific new partitions, not old ones).
   
   The second error is caused by a configuration conflict.
   
   # Changes
   A `Consumer#commitSync` is added after each verification to ensure the next 
verification won't consume old data.
   
   Fixed the test to run only with `groupProtocol = classic`.
   
   Successfully run 500 times in local: 
   <img width="924" height="399" alt="Screenshot 2025-11-24 at 6 56 00 PM" 
src="https://github.com/user-attachments/assets/92e9cdd7-0726-4711-9f0e-c69568432663";
 />
   
   


-- 
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]

Reply via email to