artemlivshits commented on code in PR #17093:
URL: https://github.com/apache/kafka/pull/17093#discussion_r1775712207


##########
core/src/main/scala/kafka/tools/StorageTool.scala:
##########
@@ -167,6 +172,65 @@ object StorageTool extends Logging {
     }
   }
 
+  def runFeatureDependenciesCommand(
+    namespace: Namespace,
+    printStream: PrintStream
+  ): Unit = {
+    val featureArgs = 
Option(namespace.getList[String]("feature")).map(_.asScala.toList).getOrElse(List.empty)
+
+    // Iterate over each feature specified with --feature
+    if (featureArgs != null) {
+      for (featureArg <- featureArgs) {
+        val Array(featureName, versionStr) = featureArg.split("=")
+
+        val featureLevel = try {
+          versionStr.toShort
+        } catch {
+          case _: NumberFormatException =>
+            throw new TerseFailure(s"Invalid version format: $versionStr for 
feature $featureName")
+        }
+
+        if (featureName == MetadataVersion.FEATURE_NAME) {
+          val metadataVersion = try {
+            MetadataVersion.fromFeatureLevel(featureLevel)
+          } catch {
+            case _: IllegalArgumentException =>
+              throw new TerseFailure(s"Unsupported metadata.version 
$featureLevel")

Review Comment:
   Maybe say "unknown" or "invalid" instead of "unsupported"?   In other places 
too.



-- 
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

Reply via email to