MINOR: Fix ListOffsetsRequestTest.testResponseIncludesLeaderEpoch#13747
Conversation
| val secondLeaderId = TestUtils.awaitLeaderChange(servers, partition, firstLeaderId) | ||
| // make sure high watermark of new leader has caught up | ||
| TestUtils.waitUntilTrue(() => sendRequest(secondLeaderId, 0L, -1).errorCode() != Errors.OFFSET_NOT_AVAILABLE.code(), | ||
| TestUtils.waitUntilTrue(() => sendRequest(secondLeaderId, ListOffsetsRequest.LATEST_TIMESTAMP, -1).errorCode != Errors.OFFSET_NOT_AVAILABLE.code, |
There was a problem hiding this comment.
OFFSET_NOT_AVAILABLE is only returned when LATEST_TIMESTAMP or MAX_TIMESTAMP are used.
There was a problem hiding this comment.
So, if my understanding is correct, the test failure is because we are using the the OFFSET_NOT_AVAILABLE to identify if the new leader has caught up, but the OFFSET_NOT_AVAILABLE error only throws when requesting LATEST_TIMESTAMP or a timestamp beyond the last fetchable offset. Since we were using a small number of timestamp, this wait will pass immediately, and cause the below assertion failure with OFFSET_NOT_AVAILABLE sometimes.
Is this correct? If so, this change LGTM! Thanks.
| val secondLeaderId = TestUtils.awaitLeaderChange(servers, partition, firstLeaderId) | ||
| // make sure high watermark of new leader has caught up | ||
| TestUtils.waitUntilTrue(() => sendRequest(secondLeaderId, 0L, -1).errorCode() != Errors.OFFSET_NOT_AVAILABLE.code(), | ||
| TestUtils.waitUntilTrue(() => sendRequest(secondLeaderId, ListOffsetsRequest.LATEST_TIMESTAMP, -1).errorCode != Errors.OFFSET_NOT_AVAILABLE.code, |
There was a problem hiding this comment.
So, if my understanding is correct, the test failure is because we are using the the OFFSET_NOT_AVAILABLE to identify if the new leader has caught up, but the OFFSET_NOT_AVAILABLE error only throws when requesting LATEST_TIMESTAMP or a timestamp beyond the last fetchable offset. Since we were using a small number of timestamp, this wait will pass immediately, and cause the below assertion failure with OFFSET_NOT_AVAILABLE sometimes.
Is this correct? If so, this change LGTM! Thanks.
|
Thanks @dajac for fixing this intermittent failure. |
…3747) Fix flaky ListOffsetsRequestTest.testResponseIncludesLeaderEpoch. It specifically fixes failures seen [here](https://ci-builds.apache.org/blue/organizations/jenkins/Kafka%2Fkafka-pr/detail/PR-13535/33/tests/). Reviewers: Luke Chen <showuon@gmail.com>
Fix flaky ListOffsetsRequestTest.testResponseIncludesLeaderEpoch. It specifically fixes failures seen here.
Committer Checklist (excluded from commit message)