mumrah commented on code in PR #19012: URL: https://github.com/apache/kafka/pull/19012#discussion_r1967926963
########## metadata/src/test/java/org/apache/kafka/image/loader/MetadataLoaderTest.java: ########## @@ -344,15 +344,16 @@ public void testLoadEmptySnapshot() throws Exception { setHighWaterMarkAccessor(() -> OptionalLong.of(0L)). build()) { loader.installPublishers(publishers).get(); - loader.handleCommit( - MockBatchReader.newSingleBatchReader(400, 50, List.of( - new ApiMessageAndVersion(new FeatureLevelRecord() - .setName(MetadataVersion.FEATURE_NAME) - .setFeatureLevel(MINIMUM_VERSION.featureLevel()), (short) 0))) - ); loadEmptySnapshot(loader, 200); + loader.waitForAllEventsToBeHandled(); + assertFalse(publishers.get(0).firstPublish.isDone()); + loader.handleCommit(MockBatchReader.newSingleBatchReader(250, 50, List.of( Review Comment: IIUC, this matches reality more closely. Here we load an empty snapshot before reading in a MV record. The publisher still waits until a controller record is replayed before the firstPublish future is completed, but with this we can ensure loading an empty snapshot first does not inadvertently fire it. -- 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