FrankYang0529 opened a new pull request, #18997: URL: https://github.com/apache/kafka/pull/18997
When we initialize `FeatureControlManager` in `QuorumController` [0], we don't set `bootstrapMetadata` for it, so it use `Metadata.latestProduction()` [1]. In the test case, we use `IBP_3_7_IV0` as `bootstrapMetadata` [2]. When initializing `QuorumController`, it takes time to replay record to overwrite `FeatureControlManager#metadataVersion`. If we add `Thread.sleep(1000L)` before `metadataVersion.set(mv)` [3], we can reproduce the flaky test steadily. I'm not sure whether setting `bootstrapMetadata` to `FeatureControlManager` is correct, so I fix the case by waiting `metadataVersion` is overwrote. [0] https://github.com/apache/kafka/blob/8f13e7c20737400a2b7b93449c20146089df00a6/metadata/src/main/java/org/apache/kafka/controller/QuorumController.java#L1536-L1541 [1] https://github.com/apache/kafka/blob/8f13e7c20737400a2b7b93449c20146089df00a6/metadata/src/main/java/org/apache/kafka/controller/FeatureControlManager.java#L57 [2] https://github.com/apache/kafka/blob/8f13e7c20737400a2b7b93449c20146089df00a6/metadata/src/test/java/org/apache/kafka/controller/QuorumControllerTest.java#L177-L178 [3] https://github.com/apache/kafka/blob/8f13e7c20737400a2b7b93449c20146089df00a6/metadata/src/main/java/org/apache/kafka/controller/FeatureControlManager.java#L371-L379 ### Committer Checklist (excluded from commit message) - [ ] Verify design and implementation - [ ] Verify test coverage and CI build status - [ ] Verify documentation (including upgrade notes) -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org