[ 
https://issues.apache.org/jira/browse/KAFKA-2055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14503051#comment-14503051
 ] 

Fangmin Lv commented on KAFKA-2055:
-----------------------------------

There is a case that the leader is shutting down just before syncing the last 
high watermark to the followers. After that, one of the followers will be 
elected as the new leader, which will return the previous high watermark when 
calling the consumer.seekToEnd(). This is why the 
ConsumerBounceTest.testSeekAndCommitWithBrokerFailures failed occasionally. 

For example, assume broker B0 is the leader of topic partition (topic, 0), 
broker B1 and B2 are followers.

1. At the moment before B0 is going to shutdown, the (LOE, HW) on B0, B1, B2 
are (1000, 1000), (1000, 984), (1000, 984).
2. B0 is shutting down.
3. B1 and B2 issue fetch request with fetch offset 1000.
4. B1 and B2 received error in fetch request.
5. Consumer send seekToEnd request to the leader, but it failed due to the new 
leader is not ready.
6. One of B1 or B2 is elected as the new leader.
7. When the client retry to fetch the last offset, the new leader will return 
the HW 984.
8. Assert failure, as the client is expecting to receive 1000 instead of 984.

Is this the expected behaviour of Kafka? Any suggestion to fix this except 
adding sleep time before starting BounceBrokerSchedule in the test case?

> ConsumerBounceTest.testSeekAndCommitWithBrokerFailures transient failure
> ------------------------------------------------------------------------
>
>                 Key: KAFKA-2055
>                 URL: https://issues.apache.org/jira/browse/KAFKA-2055
>             Project: Kafka
>          Issue Type: Sub-task
>            Reporter: Guozhang Wang
>            Assignee: Fangmin Lv
>              Labels: newbie
>
> {code}
> kafka.api.ConsumerBounceTest > testSeekAndCommitWithBrokerFailures FAILED
>     java.lang.AssertionError: expected:<1000> but was:<976>
>         at org.junit.Assert.fail(Assert.java:92)
>         at org.junit.Assert.failNotEquals(Assert.java:689)
>         at org.junit.Assert.assertEquals(Assert.java:127)
>         at org.junit.Assert.assertEquals(Assert.java:514)
>         at org.junit.Assert.assertEquals(Assert.java:498)
>         at 
> kafka.api.ConsumerBounceTest.seekAndCommitWithBrokerFailures(ConsumerBounceTest.scala:117)
>         at 
> kafka.api.ConsumerBounceTest.testSeekAndCommitWithBrokerFailures(ConsumerBounceTest.scala:98)
> kafka.api.ConsumerBounceTest > testSeekAndCommitWithBrokerFailures FAILED
>     java.lang.AssertionError: expected:<1000> but was:<913>
>         at org.junit.Assert.fail(Assert.java:92)
>         at org.junit.Assert.failNotEquals(Assert.java:689)
>         at org.junit.Assert.assertEquals(Assert.java:127)
>         at org.junit.Assert.assertEquals(Assert.java:514)
>         at org.junit.Assert.assertEquals(Assert.java:498)
>         at 
> kafka.api.ConsumerBounceTest.seekAndCommitWithBrokerFailures(ConsumerBounceTest.scala:117)
>         at 
> kafka.api.ConsumerBounceTest.testSeekAndCommitWithBrokerFailures(ConsumerBounceTest.scala:98)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to