Skip to content
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

KAFKA-18052: Decouple the dependency of feature stable version to the metadata version #17886

Merged
merged 20 commits into from
Dec 5, 2024

Conversation

dongnuo123
Copy link
Collaborator

@dongnuo123 dongnuo123 commented Nov 20, 2024

Currently the validation of feature upgrade relies on the supported version range generated during registration. For a given feature, its max supported feature version in production is set to be the default version value (the latest feature version with bootstrap metadata value smaller or equal to the latest production metadata value).

This patch introduces a LATEST_PRODUCTION value independent from the metadata version to each feature so that the highest supported feature version can be customized by the feature owner.

The change only applies to dynamic feature upgrade. During formatting, we still use the default value associated the metadata version.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@github-actions github-actions bot added core Kafka Broker small Small PRs labels Nov 20, 2024
@dongnuo123 dongnuo123 changed the title [Draft] add latest production to features KAFKA-18052: Decouple the dependency of feature stable version to the metadata version Nov 20, 2024
@dongnuo123 dongnuo123 changed the title KAFKA-18052: Decouple the dependency of feature stable version to the metadata version [Draft] KAFKA-18052: Decouple the dependency of feature stable version to the metadata version Nov 20, 2024
@dongnuo123 dongnuo123 changed the title [Draft] KAFKA-18052: Decouple the dependency of feature stable version to the metadata version KAFKA-18052: Decouple the dependency of feature stable version to the metadata version Nov 21, 2024
Copy link
Contributor

@junrao junrao left a comment

Choose a reason for hiding this comment

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

@dongnuo123 : Thanks for the PR. Left a comment.

@github-actions github-actions bot removed the small Small PRs label Nov 21, 2024
Copy link
Contributor

@junrao junrao left a comment

Choose a reason for hiding this comment

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

@dongnuo123 : Thanks for the updated PR. A few minor comments.

Copy link
Contributor

@junrao junrao left a comment

Choose a reason for hiding this comment

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

@dongnuo123 : Thanks for the updated PR. A few more comments.

UNIT_TEST_VERSION_2(UnitTestFeatureVersion.FEATURE_NAME + ".2", new FeatureVersion[]{UT_FV2_0, UT_FV2_1}, UT_FV2_0),
UNIT_TEST_VERSION_3(UnitTestFeatureVersion.FEATURE_NAME + ".3", new FeatureVersion[]{UT_FV3_0, UT_FV3_1}, UT_FV3_1),
UNIT_TEST_VERSION_4(UnitTestFeatureVersion.FEATURE_NAME + ".4", new FeatureVersion[]{UT_FV4_0, UT_FV4_1}, UT_FV4_1),
UNIT_TEST_VERSION_5(UnitTestFeatureVersion.FEATURE_NAME + ".5", new FeatureVersion[]{UT_FV5_0, UT_FV5_1}, UT_FV5_1);
Copy link
Contributor

Choose a reason for hiding this comment

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

It's kind of weird to include unit test code in production code.

Copy link
Collaborator Author

@dongnuo123 dongnuo123 Dec 3, 2024

Choose a reason for hiding this comment

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

Yeah it's a bit weird. The formatter unit tests are also failing because of these unrecognized features. I've tried several ways of addressing it but still don't have a rather good solution.

The issues are that 1) Feature is an enum so we can't extend from it to create a new enum specially for unit tests 2) The validation calls featureFromName which needs the Features[] array, so the Features for unit tests have to really exist.

Another way to separate the production features and the unit test features is to create an exactly same enum called UnitTestFeatures, but that will be much duplication and pretty hard to maintain, which I don't really want to adopt

Copy link
Contributor

@junrao junrao left a comment

Choose a reason for hiding this comment

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

@dongnuo123 : Thanks for the updated PR. A few more comments.

dependencyFeature.defaultLevel(MetadataVersion.LATEST_PRODUCTION)));
}
} else {
if (dependency.getValue() > defaultVersion.bootstrapMetadataVersion().featureLevel()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

defaultVersion.bootstrapMetadataVersion().featureLevel() => metadataVersion ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The two are not necessarily equal. For instance, when metadataVersion=120, the feature has versions

  • FV_1, bootstrap MV = 119
  • FV_2, bootstrap MV = 121

Then defaultVersion.bootstrapMetadataVersion() will be 119. Using metadataVersion would also work since we do check when the two are equal, but I feel comparing with the bootstrap MV makes more sense.


// For testing the default value has MV dependency that is ahead of the bootstrap MV.
UT_FV7_0(0, MetadataVersion.MINIMUM_KRAFT_VERSION, Collections.singletonMap(MetadataVersion.FEATURE_NAME, MetadataVersion.IBP_3_7_IV0.featureLevel())),
UT_FV7_1(1, MetadataVersion.IBP_3_8_IV0, Collections.singletonMap(MetadataVersion.FEATURE_NAME, MetadataVersion.IBP_3_8_IV0.featureLevel()));
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems that we don't really need UT_FV7_1?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Adding UT_FV7_1 was meant to test when the failed feature version is not the default version of latest production mv, but yes there's no impact removing it

Copy link
Contributor

@junrao junrao left a comment

Choose a reason for hiding this comment

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

@dongnuo123 : Thanks for the updated PR. Just a few minor comments.

Copy link
Contributor

@junrao junrao left a comment

Choose a reason for hiding this comment

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

@dongnuo123 : Thanks for the updated PR. LGTM. The failed tests are marked as flaky. So, will merge this PR.

@junrao junrao merged commit e30edb3 into apache:trunk Dec 5, 2024
7 of 8 checks passed
@junrao junrao deleted the feature-version-latest-production branch December 5, 2024 19:07
tedyu pushed a commit to tedyu/kafka that referenced this pull request Jan 6, 2025
… metadata version (apache#17886)

Currently the validation of feature upgrade relies on the supported version range generated during registration. For a given feature, its max supported feature version in production is set to be the default version value (the latest feature version with bootstrap metadata value smaller or equal to the latest production metadata value).

This patch introduces a LATEST_PRODUCTION value independent from the metadata version to each feature so that the highest supported feature version can be customized by the feature owner.

The change only applies to dynamic feature upgrade. During formatting, we still use the default value associated the metadata version.

Reviewers: Justine Olshan <jolshan@confluent.io>, Jun Rao <junrao@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants