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

   *What*
   
   - Currently in `ShareConsumerImpl`, there is a chance we could be sending 
multiple `ShareFetchEvents` for a single `poll()`.
   - This could happen when the `ShareFetchBuffer` is empty in the first wait 
and the `pollTimer` has not completed yet, then we would send multiple events.
   
   - Usually the `ShareFetchBuffer` would wait for a time until the 
pollTimeout, so we would not send multiple events, but the buffer wait time is 
also controlled by `applicationEventHandler.maximumTimeToWait()` which can 
return lower values (even 0) in some cases (especially during startup of 
heartbeat request manager).
   
   - If this happens, we will see multiple events sent, and this could even 
lead to multiple fetching from the broker (sort of a fetch and a pre-fetch) if 
the response for the previous `ShareFetchEvent` arrives before the next 
`ShareFetchEvent` was processed. 
   - To avoid this, we have a check now which only sends one `ShareFetchEvent` 
per poll.
   
   - This was the reason a couple of tests were flaky in KafkaShareConsumerTest 
- https://issues.apache.org/jira/browse/KAFKA-18794. The PR fixes the 
flakiness, now the tests reliably pass locally.
   
   


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