Jason Gustafson created KAFKA-13966:
---------------------------------------
Summary: Flaky test `QuorumControllerTest.testUnregisterBroker`
Key: KAFKA-13966
URL: https://issues.apache.org/jira/browse/KAFKA-13966
Project: Kafka
Issue Type: Bug
Reporter: Jason Gustafson
We have seen the following assertion failure in
`QuorumControllerTest.testUnregisterBroker`:
```
org.opentest4j.AssertionFailedError: expected: <2> but was: <0> 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:166) at
org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:161) at
org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:628) at
org.apache.kafka.controller.QuorumControllerTest.testUnregisterBroker(QuorumControllerTest.java:494)
```
I reproduced it by running the test in a loop. It looks like what happens is
that the BrokerRegistration request is able to get interleaved between the
leader change event and the write of the bootstrap metadata. Something like
this:
# handleLeaderChange() start
# appendWriteEvent(registerBroker)
# appendWriteEvent(bootstrapMetadata)
# handleLeaderChange() finish
# registerBroker() -> writes broker registration to log
# bootstrapMetadata() -> writes bootstrap metadata to log
--
This message was sent by Atlassian Jira
(v8.20.7#820007)