You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ch...@apache.org on 2024/07/19 02:04:38 UTC
(kafka) branch trunk updated: KAFKA-17118 remove useless code in StorageTool (#16622)
This is an automated email from the ASF dual-hosted git repository.
chia7712 pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/trunk by this push:
new 4fd0f4095e4 KAFKA-17118 remove useless code in StorageTool (#16622)
4fd0f4095e4 is described below
commit 4fd0f4095e441fd18a40294d1b00228310f6835d
Author: xijiu <42...@qq.com>
AuthorDate: Fri Jul 19 10:04:32 2024 +0800
KAFKA-17118 remove useless code in StorageTool (#16622)
Reviewers: Chia-Ping Tsai <ch...@gmail.com>
---
core/src/main/scala/kafka/tools/StorageTool.scala | 31 ----------------------
.../scala/unit/kafka/tools/StorageToolTest.scala | 9 -------
2 files changed, 40 deletions(-)
diff --git a/core/src/main/scala/kafka/tools/StorageTool.scala b/core/src/main/scala/kafka/tools/StorageTool.scala
index fdc29c4b0c3..41c451a35e2 100644
--- a/core/src/main/scala/kafka/tools/StorageTool.scala
+++ b/core/src/main/scala/kafka/tools/StorageTool.scala
@@ -482,37 +482,6 @@ object StorageTool extends Logging {
BootstrapMetadata.fromRecords(metadataRecords, source)
}
-
- def buildMetadataProperties(
- clusterIdStr: String,
- config: KafkaConfig
- ): MetaProperties = {
- val effectiveClusterId = try {
- Uuid.fromString(clusterIdStr)
- } catch {
- case e: Throwable => throw new TerseFailure(s"Cluster ID string $clusterIdStr " +
- s"does not appear to be a valid UUID: ${e.getMessage}")
- }
- if (config.nodeId < 0) {
- throw new TerseFailure(s"The node.id must be set to a non-negative integer. We saw ${config.nodeId}")
- }
- new MetaProperties.Builder().
- setClusterId(effectiveClusterId.toString).
- setNodeId(config.nodeId).
- build()
- }
-
- def formatCommand(
- stream: PrintStream,
- directories: Seq[String],
- metaProperties: MetaProperties,
- metadataVersion: MetadataVersion,
- ignoreFormatted: Boolean
- ): Int = {
- val bootstrapMetadata = buildBootstrapMetadata(metadataVersion, None, "format command")
- formatCommand(stream, directories, metaProperties, bootstrapMetadata, metadataVersion, ignoreFormatted)
- }
-
def formatCommand(
stream: PrintStream,
directories: Seq[String],
diff --git a/core/src/test/scala/unit/kafka/tools/StorageToolTest.scala b/core/src/test/scala/unit/kafka/tools/StorageToolTest.scala
index 33d969e2257..8cd477b896a 100644
--- a/core/src/test/scala/unit/kafka/tools/StorageToolTest.scala
+++ b/core/src/test/scala/unit/kafka/tools/StorageToolTest.scala
@@ -255,15 +255,6 @@ Found problem:
assertEquals(0, runFormatCommand(stream2, Seq(availableDir1.toString, unavailableDir1.toString), ignoreFormatted = true))
}
- @Test
- def testFormatWithInvalidClusterId(): Unit = {
- val config = new KafkaConfig(newSelfManagedProperties())
- assertEquals("Cluster ID string invalid does not appear to be a valid UUID: " +
- "Input string `invalid` decoded as 5 bytes, which is not equal to the expected " +
- "16 bytes of a base64-encoded UUID", assertThrows(classOf[TerseFailure],
- () => StorageTool.buildMetadataProperties("invalid", config)).getMessage)
- }
-
@Test
def testDefaultMetadataVersion(): Unit = {
val namespace = StorageTool.parseArguments(Array("format", "-c", "config.props", "-t", "XcZZOzUqS4yHOjhMQB6JLQ"))