-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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-18634: Fix ELR metadata version issues #18680
base: trunk
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the changes are because the PartitionRecord needs the feature version to determine if it should keep the ELR related fields. So I added the finalized features to the ImageWriterOptions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for my understanding, how is ELRV_1 currently enabled? Is it currently only possible via the storage tool feature argument?
also noticed
EligibleLeaderReplicasVersion.isEligibleLeaderReplicasFeatureEnabeld()
has a typo and seems to be dead codeEligibleLeaderReplicasVersion.fromFeatureLevel(short version)
also seems unused
@@ -113,15 +113,15 @@ public enum MetadataVersion { | |||
// Bootstrap metadata version for version 1 of the GroupVersion feature (KIP-848). | |||
IBP_4_0_IV0(22, "4.0", "IV0", false), | |||
|
|||
// Add ELR related supports (KIP-966). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jira mentioned we should include what metadata records changed, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@@ -30,6 +31,7 @@ public final class ImageWriterOptions { | |||
public static class Builder { | |||
private MetadataVersion metadataVersion; | |||
private MetadataVersion requestedMetadataVersion; | |||
private Map<String, Short> finalizedFeatures; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we derive the MetadataVersion from the finalizedFeatures map? or alternatively just store EligibleLeaderReplicasVersion instead of the whole features map
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
metadata/src/main/java/org/apache/kafka/image/loader/MetadataLoader.java
Outdated
Show resolved
Hide resolved
@@ -387,7 +387,7 @@ public ApiMessageAndVersion toRecord(Uuid topicId, int partitionId, ImageWriterO | |||
setLeaderRecoveryState(leaderRecoveryState.value()). | |||
setLeaderEpoch(leaderEpoch). | |||
setPartitionEpoch(partitionEpoch); | |||
if (options.metadataVersion().isElrSupported()) { | |||
if (options.isEligibleLeaderReplicasEnabled()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case where metadata is lost, we need to use the lossHandler to print a warning message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume it is not relevant to this PR but I add the metadata check here.
Clean up the places that should not use MV to determine ELR is enabled
Mark 4.0IV1 stable.
https://issues.apache.org/jira/browse/KAFKA-18634