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-18555: Avoid casting MetadataCache to KRaftMetadataCache #18632

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

Conversation

FrankYang0529
Copy link
Member

@FrankYang0529 FrankYang0529 commented Jan 20, 2025

The ZkMetadataCache is removed in https://issues.apache.org/jira/browse/KAFKA-18373. We should pull up the relevant methods so that no casting from MetadataCache to KRaftMetadataCache is required.

Add following methods to MetadataCache:

  • getAliveBrokerEpoch
  • isBrokerFenced
  • isBrokerShuttingDown
  • describeTopicResponse

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 the core Kafka Broker label Jan 20, 2025
@FrankYang0529
Copy link
Member Author

@ijuma The only remaining casting is in DescribeTopicPartitionsRequestHandler. It uses KRaftMetadataCache#getTopicMetadataForDescribeTopicResponse. Do you think that we should either add it to MetadataCache or refactoring it to move related logic to DescribeTopicPartitionsRequestHandler? Or we can just keep it as current implementation? Thanks.

  val describeTopicPartitionsRequestHandler : DescribeTopicPartitionsRequestHandler = new DescribeTopicPartitionsRequestHandler(
    metadataCache.asInstanceOf[KRaftMetadataCache], authHelper, config)

@ijuma
Copy link
Member

ijuma commented Jan 20, 2025

It's ok to pull up that method to MetadataCache, but we should take the chance and make it more concise. Instead of metadataCache.getTopicMetadataForDescribeTopicResponse, we can simply call it metadataCache.describeTopicResponse.

@FrankYang0529 FrankYang0529 requested a review from ijuma January 21, 2025 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Kafka Broker
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants