Skip to content

KAFKA-19544: Improve MetadataVersion.fromVersionString() to take an enableUnstableFeature flag #20248

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

DL1231
Copy link
Contributor

@DL1231 DL1231 commented Jul 28, 2025

Improve MetadataVersion.fromVersionString() to take an enableUnstableFeature flag,
and enable FeatureCommand and StorageTool to leverage the exception message from fromVersionString.

@github-actions github-actions bot added triage PRs from the community core Kafka Broker tools kraft labels Jul 28, 2025
@@ -315,11 +305,9 @@ private static void handleUpgradeOrDowngrade(String op, Namespace namespace, Adm
if (metadata != null) {
System.out.println(" `metadata` flag is deprecated and may be removed in a future release.");
try {
metadataVersion = MetadataVersion.fromVersionString(metadata);
metadataVersion = MetadataVersion.fromVersionString(metadata, false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should allow users to update the unstable feature using feature tool, right?

Copy link
Contributor Author

@DL1231 DL1231 Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This refers to the original implementation. When originally throwing an exception using MetadataVersion.latestProduction(), the parameter passed to fromVersionString() was false. When originally throwing an exception using MetadataVersion.latestTesting(), the parameter passed to fromVersionString() was true.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it remains consistent with the original implementation. However, it also introduces a new restriction

        } else if (!unstableFeatureVersionsEnabled && !metadataVersion.isProduction()) {
            throw new IllegalArgumentException(errorMsg);

For example, users may download the trunk source code to test an upgrade with an older version of Kafka, and this new restriction could prevent them from upgrading to a non-production MV. Shouldn't it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-approved core Kafka Broker kraft tools triage PRs from the community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants