kevin-wu24 commented on code in PR #20707:
URL: https://github.com/apache/kafka/pull/20707#discussion_r2511640322
##########
metadata/src/test/java/org/apache/kafka/metadata/storage/FormatterTest.java:
##########
@@ -152,6 +154,19 @@ public void testDirectories(int numDirs) throws Exception {
}
}
+ @Test
+ public void testBrokerRoleSkipsBootstrapSnapshot() throws Exception {
+ try (TestEnv testEnv = new TestEnv(1)) {
+ FormatterContext context = testEnv.newFormatter();
+ context.formatter.setWriteBootstrapSnapshot(false);
+ context.formatter.run();
+ File clusterMetadataDir = new File(testEnv.directory(0),
String.format("%s-%d",
Review Comment:
~~`testEnv.directory(0)` contains the cluster metadata directory in these
tests. Look at `testEnv.newFormatter()`. When you create the file here, you are
looking for `tempDirectoryPath/__cluster-metadata-0`, which is a directory that
SHOULD exist on the broker after formatting. However, the
file`tempDirectoryPath/__cluster-metadata-0/0-0.checkpoint` SHOULD NOT exist on
the broker.~~
EDIT: Apologies, we don't write `/__cluster_metadata-0/` at format time
unless we are also writing `0-0.checkpoint`. We can keep this test as is.
However, for the tests we format successfully on a controller, we should add
this check:
```
File clusterMetadataDir = new File(testEnv.directory(0),
String.format("%s-%d",
CLUSTER_METADATA_TOPIC_PARTITION.topic(),
CLUSTER_METADATA_TOPIC_PARTITION.partition()));
assertTrue(clusterMetadataDir.exists());
File bootstrapCheckpoint = new File(clusterMetadataDir,
"00000000000000000000-0000000000.checkpoint");
assertTrue(bootstrapCheckpoint.exists());
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]