Skip to content

MINOR: Remove dead code maybeWarnIfOversizedRecords #19316

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

Merged
merged 2 commits into from
Apr 1, 2025

Conversation

ijuma
Copy link
Member

@ijuma ijuma commented Mar 30, 2025

The metadataVersionSupplier is unused after this - remove it.

Also remove redundant metadataVersion.fetchRequestVersion >= 13 check in RemoteLeaderEndPoint - the minimum version returned by this method is 13.

Reviewers: Chia-Ping Tsai [email protected]

The `metadataVersionSupplier` is unused after this - remove it.
@github-actions github-actions bot added core Kafka Broker performance small Small PRs labels Mar 30, 2025
@ijuma ijuma requested a review from dajac March 31, 2025 14:16
@@ -161,15 +157,6 @@ class ReplicaFetcherThread(name: String,
}
}

private def maybeWarnIfOversizedRecords(records: MemoryRecords, topicPartition: TopicPartition): Unit = {
// oversized messages don't cause replication to fail from fetch request version 3 (KIP-74)
if (metadataVersionSupplier().fetchRequestVersion <= 2 && records.sizeInBytes > 0 && records.validBytes <= 0)
Copy link
Member

Choose a reason for hiding this comment

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

It seems another use case of fetchRequestVersion is dead code. Maybe we can remove it as well?

      val version: Short = if (metadataVersion.fetchRequestVersion >= 13 && !fetchData.canUseTopicIds) {
        12
      } else {
        metadataVersion.fetchRequestVersion
      }

val version: Short = if (metadataVersion.fetchRequestVersion >= 13 && !fetchData.canUseTopicIds) {

Copy link
Member Author

Choose a reason for hiding this comment

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

I think you're saying that IBP 3.3 implies fetch request 13 or higher. That makes sense, I pushed a commit that removes that check.

Copy link
Member Author

Choose a reason for hiding this comment

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

I also updated the PR description.

@@ -203,7 +203,7 @@ class RemoteLeaderEndPoint(logPrefix: String,
None
} else {
val metadataVersion = metadataVersionSupplier()
val version: Short = if (metadataVersion.fetchRequestVersion >= 13 && !fetchData.canUseTopicIds) {
val version: Short = if (!fetchData.canUseTopicIds) {
Copy link
Member

Choose a reason for hiding this comment

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

This is interesting. IIRC, the topic id of fetch is introduced in 3.1, so canUseTopicIds should be always enabled after we bump the baseline of MV to 3.3.

Copy link
Member Author

@ijuma ijuma Apr 1, 2025

Choose a reason for hiding this comment

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

Yes, I looked into that after your original comment, but it's a larger change since some of the code is shared and topic ids are optional in the shared code. I think we can file a JIRA ticket to make this change via a separate PR.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

As part of that ticket, we should also remove the getOrElse below and change PartitionFetchState.topicId not to be Optional, etc.

fetchState.topicId.getOrElse(Uuid.ZERO_UUID),

@ijuma ijuma merged commit ccf2510 into apache:trunk Apr 1, 2025
30 checks passed
@ijuma ijuma deleted the remove-metadata-version-replica-fetcher branch April 1, 2025 13:36
janchilling pushed a commit to janchilling/kafka that referenced this pull request Apr 4, 2025
The `metadataVersionSupplier` is unused after this - remove it.

Also remove redundant `metadataVersion.fetchRequestVersion >= 13` check
in `RemoteLeaderEndPoint` - the minimum version returned by this method
is `13`.

Reviewers: Chia-Ping Tsai <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Kafka Broker performance small Small PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants