jsancio commented on code in PR #19545:
URL: https://github.com/apache/kafka/pull/19545#discussion_r2058871135
##########
core/src/test/scala/integration/kafka/server/KRaftClusterTest.scala:
##########
@@ -1619,6 +1619,55 @@ class KRaftClusterTest {
}
}
+ /**
+ * Test that once a cluster is formatted, a bootstrap.metadata file that
contains an unsupported
+ * MetadataVersion is not a problem. This is a regression test for
KAFKA-19192.
+ */
+ @Test
+ def testOldBootstrapMetadataFile(): Unit = {
+ val baseDirectory = TestUtils.tempDir().toPath()
+ val cluster = new KafkaClusterTestKit.Builder(
+ new TestKitNodes.Builder().
+ setNumBrokerNodes(1).
+ setNumControllerNodes(1).
+ setBaseDirectory(baseDirectory).
+ build()).
+ setDeleteOnClose(false).
+ build()
+ try {
+ cluster.format()
+ cluster.startup()
+ cluster.waitForReadyBrokers()
+ } finally {
+ cluster.close()
+ }
Review Comment:
Scala recently added the Using type. It has support for closing or releasing
resources.
```java
Using.resource(new KafkaClusterTestKit.Builder(
new TestKitNodes.Builder().
setNumBrokerNodes(1).
setNumControllerNodes(1).
setBaseDirectory(baseDirectory).
build()).
setDeleteOnClose(false).
build()
) { cluster =>
cluster.format()
cluster.startup()
cluster.waitForReadyBrokers()
}
```
This comment also applies to the creation and usage of the `cluster2` object
in this method.
##########
core/src/test/scala/integration/kafka/server/KRaftClusterTest.scala:
##########
Review Comment:
This comment applies to the PR description.
In the description you have "When the server tries to read the
bootstrap.metadata file". Do you mean "the bootstrap.checkpoint" file?
--
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]