jolshan commented on code in PR #15685:
URL: https://github.com/apache/kafka/pull/15685#discussion_r1618016483
##########
core/src/main/scala/kafka/tools/StorageTool.scala:
##########
@@ -60,24 +60,28 @@ object StorageTool extends Logging {
case "format" =>
val directories = configToLogDirectories(config.get)
val clusterId = namespace.getString("cluster_id")
- val metadataVersion = getMetadataVersion(namespace,
-
Option(config.get.originals.get(ReplicationConfigs.INTER_BROKER_PROTOCOL_VERSION_CONFIG)).map(_.toString))
- if (!metadataVersion.isKRaftSupported) {
- throw new TerseFailure(s"Must specify a valid KRaft
metadata.version of at least ${MetadataVersion.IBP_3_0_IV0}.")
- }
- if (!metadataVersion.isProduction) {
- if (config.get.unstableMetadataVersionsEnabled) {
- System.out.println(s"WARNING: using pre-production
metadata.version $metadataVersion.")
- } else {
- throw new TerseFailure(s"The metadata.version $metadataVersion
is not ready for production use yet.")
- }
- }
val metaProperties = new MetaProperties.Builder().
setVersion(MetaPropertiesVersion.V1).
setClusterId(clusterId).
setNodeId(config.get.nodeId).
build()
val metadataRecords : ArrayBuffer[ApiMessageAndVersion] =
ArrayBuffer()
+ val specifiedFeatures: util.List[String] =
namespace.getList("feature")
+ if (namespace.getString("release_version") != null &&
specifiedFeatures != null) {
+ throw new TerseFailure("Both --release-version and --feature were
set. Only one of the two flags can be set.")
+ }
+ val featureNamesAndLevelsMap =
featureNamesAndLevels(Option(specifiedFeatures).getOrElse(Collections.emptyList).asScala.toList)
+ val metadataVersion = getMetadataVersion(namespace,
featureNamesAndLevelsMap,
+
Option(config.get.originals.get(ReplicationConfigs.INTER_BROKER_PROTOCOL_VERSION_CONFIG)).map(_.toString))
+ validateMetadataVersion(metadataVersion, config)
+ // Get all other features, validate, and create records for them
+ generateFeatureRecords(
+ metadataRecords,
+ metadataVersion,
+ featureNamesAndLevelsMap,
+ Features.PRODUCTION_FEATURES.asScala.toList,
+ !Option(namespace.getString("release_version")).isEmpty
Review Comment:
If we use feature flags to specify MV, we should not default based on the MV
but instead use latest default for non-specified features.
The difference is specifying MV using `--version-default` vs `feature`
--
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]