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

Optimizing By Using Precomputed Set of Partitions in DatastreamMetadata #960

Conversation

shrinandthakkar
Copy link
Collaborator

Summary

  • By using a precomputed set of topic partitions, we can reduce the runtime complexity of the partition assignment logic, avoiding the need to compute this same set for every task.

Important: DO NOT REPORT SECURITY ISSUES DIRECTLY ON GITHUB.
For reporting security issues and contributing security fixes,
please, email security@linkedin.com instead, as described in
the contribution guidelines.

Please, take a minute to review the contribution guidelines at:
https://github.com/linkedin/Brooklin/blob/master/CONTRIBUTING.md

@@ -91,7 +91,7 @@ public Map<String, Set<DatastreamTask>> assignPartitions(
tasks.forEach(task -> {
if (task.getTaskPrefix().equals(datastreamGroupName)) {
Set<String> retainedPartitions = new HashSet<>(task.getPartitionsV2());
retainedPartitions.retainAll(new HashSet<>(partitionMetadata.getPartitions()));
retainedPartitions.retainAll(partitionMetadata.getPartitions());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is partitionMetadata.getPartitions() used only in the below three places ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Its used in other places as well but some basic operations on list and set are common, hence no change needed there.

@shrinandthakkar shrinandthakkar merged commit 178956c into linkedin:master Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants