ShivsundarR opened a new pull request, #19789: URL: https://github.com/apache/kafka/pull/19789
*What* https://issues.apache.org/jira/browse/KAFKA-19317 One of the test failed due to a possible race condition in `waitedPoll()` where we expect 2 records and we get only 1 record on the first `poll()`. This record wasn't acknowledged before the next `poll()` which is not allowed when share.acknowledgement.mode is set to "explicit". Hence the `IllegalStateException` was thrown. To fix this, I have refactored the test to produce and consume 1 record each in succession as that is more deterministic. On digging into the reason for this flakiness, I noticed there might be a race condition in `waitedPoll()` where we might get some records on the first `poll()` and some on later calls. waitedPoll() does not cumulatively add up the records received across the different polls, it retries until one `poll()` gives the exact number of records that it expects. So when we expect more than 1 record in `waitedPoll`, then there is a chance of records getting split across polls if `ShareFetchBuffer` does not have all the records yet. I have added a separate function which will cumulate the records across the polls and return the result and used this for tests which were calling waitedPoll() expecting multiple records. Some of these modified tests are using "explicit" mode, so we should ideally refactor these tests too to expect 1 only record at a time. These tests have clean runs in develocity though, so I have not modified these tests in this PR. We can modify them if we observe flakiness for them in future. -- 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]
