KAFKA-2632: move fetchable check ahead in handleFetchResponse#295
KAFKA-2632: move fetchable check ahead in handleFetchResponse#295guozhangwang wants to merge 3 commits into
Conversation
|
I take it that it's not easy to write a test that shows the issue? |
|
It is a bit timing-dependent that you need to have an in-flight fetch request going on while calling pause(); this cannot be easily reproduced since consumer.poll() may trigger pollOnce() multiple times. |
There was a problem hiding this comment.
I think we still need this check. There may be a rebalance between the time a fetch response is handled and the time it is returned to the user.
|
Thanks @hachikuji , comments addressed. |
There was a problem hiding this comment.
Isn't it a little dangerous to assume that the fetch position in the returned record is still relevant? Suppose we have the following sequence:
- User calls poll() and we initiate a fetch.
- User calls commitSync() (or some other blocking operation) and the fetch returns.
- User calls seek() with a new offset.
- User calls poll() and now we've written over their seeked offset.
Maybe instead we should reset the fetched position to the consumed position?
There was a problem hiding this comment.
@hachikuji I thought about this, but consumed() may return null for the first time so we cannot rely on that value either. Maybe we should just combine these two? I.e.:
If consumed() != null, set to consumed;
otherwise this MUST be the first fetch ever returned before any seek() was called, hence resetting to first offset should be safe.
|
LGTM. |
|
LGTM |
…ache#295) TICKET = N/A LI_DESCRIPTION = The testResponseIncludesLeaderEpoch method has been flaky, and sometimes fails with org.opentest4j.AssertionFailedError: expected: <(10,1)> but was: <(-1,-1)> at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55) at org.junit.jupiter.api.AssertionUtils.failNotEqual(AssertionUtils.java:62) at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182) at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:177) at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1124) at kafka.server.ListOffsetsRequestTest.testResponseIncludesLeaderEpoch(ListOffsetsRequestTest.scala:203) This PR addresses the flakiness by adding repeated checks for the condition until it is satisfied. EXIT_CRITERIA = N/A
…ache#295) TICKET = N/A LI_DESCRIPTION = The testResponseIncludesLeaderEpoch method has been flaky, and sometimes fails with org.opentest4j.AssertionFailedError: expected: <(10,1)> but was: <(-1,-1)> at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55) at org.junit.jupiter.api.AssertionUtils.failNotEqual(AssertionUtils.java:62) at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182) at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:177) at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1124) at kafka.server.ListOffsetsRequestTest.testResponseIncludesLeaderEpoch(ListOffsetsRequestTest.scala:203) This PR addresses the flakiness by adding repeated checks for the condition until it is satisfied. EXIT_CRITERIA = N/A
…ache#295) TICKET = N/A LI_DESCRIPTION = The testResponseIncludesLeaderEpoch method has been flaky, and sometimes fails with org.opentest4j.AssertionFailedError: expected: <(10,1)> but was: <(-1,-1)> at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55) at org.junit.jupiter.api.AssertionUtils.failNotEqual(AssertionUtils.java:62) at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182) at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:177) at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1124) at kafka.server.ListOffsetsRequestTest.testResponseIncludesLeaderEpoch(ListOffsetsRequestTest.scala:203) This PR addresses the flakiness by adding repeated checks for the condition until it is satisfied. EXIT_CRITERIA = N/A
No description provided.