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

[FLINK-36210] Optimize the logic for fetching topic metadata in the TopicPatternSubscriber mode #117

Merged
merged 4 commits into from
Sep 12, 2024

Conversation

xiaochen-zhou
Copy link
Contributor

@xiaochen-zhou xiaochen-zhou commented Sep 4, 2024

What is the purpose of the change

Optimize the logic for fetching topic metadata in the TopicPatternSubscriber mode to speed up task recovery.

Brief change log

In TopicPatternSubscriber mode, our current logic for fetch topic metadata for all topics and then filtering it. We can optimize this by first filtering the topic names and then fetch metadata only for the filtered topics.

Verifying this change

  • This change is a trivial rework / code cleanup without any test coverage.
  • Does this pull request potentially affect one of the following parts:
  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API, i.e., is any changed class annotated with @public(Evolving): (no)
  • The serializers: (no)
  • The runtime per-record code paths (performance sensitive): (no)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (no)
  • The S3 file system connector: (no)

Documentation

  • Does this pull request introduce a new feature? no)
  • If yes, how is the feature documented? (not applicable)

static Map<String, TopicDescription> getTopicMetadata(AdminClient adminClient, Pattern topicPattern) {
try {
Set<String> allTopicNames = adminClient.listTopics().names().get();
Set<String> patternTopicNames = allTopicNames.stream()

Choose a reason for hiding this comment

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

nit: matchedTopic* would sound nicer than patternTopic* (not just here, in the whole pr)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nit: matchedTopic* would sound nicer than patternTopic* (not just here, in the whole pr)

Thank you for your careful review, I changed to them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nit: matchedTopic* would sound nicer than patternTopic* (not just here, in the whole pr)

done.

Copy link

@akatona84 akatona84 left a comment

Choose a reason for hiding this comment

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

thx

@xiaochen-zhou
Copy link
Contributor Author

Friendly ping, do you have time to take a look @AHeise 🙏 ?

Copy link
Contributor

@AHeise AHeise left a comment

Choose a reason for hiding this comment

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

LGTM. I'll approve and merge once CI passes.

Have you seen any performance improvements with this change? Could you add that to the description? I'm assuming you are submitting the change because the old code took too long to recover.

@AHeise AHeise self-assigned this Sep 9, 2024
@AHeise
Copy link
Contributor

AHeise commented Sep 9, 2024

Don't forget to run spotless.

@xiaochen-zhou
Copy link
Contributor Author

Don't forget to run spotless.

Thanks for the reminder!

@xiaochen-zhou
Copy link
Contributor Author

run spotless

done.

@AHeise AHeise merged commit 7929b16 into apache:main Sep 12, 2024
13 checks passed
Copy link

boring-cyborg bot commented Sep 12, 2024

Awesome work, congrats on your first merged pull request!

@AHeise
Copy link
Contributor

AHeise commented Sep 12, 2024

Merged, thank you for your contribution :)

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.

3 participants