Skip to content

Optimizing By Using Precomputed Set of Partitions in DatastreamMetadata#960

Merged
shrinandthakkar merged 1 commit intolinkedin:masterfrom
shrinandthakkar:minorOptimizationUsingPreconfiguredSet
Oct 25, 2023
Merged

Optimizing By Using Precomputed Set of Partitions in DatastreamMetadata#960
shrinandthakkar merged 1 commit intolinkedin:masterfrom
shrinandthakkar:minorOptimizationUsingPreconfiguredSet

Conversation

@shrinandthakkar
Copy link
Copy Markdown
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

if (task.getTaskPrefix().equals(datastreamGroupName)) {
Set<String> retainedPartitions = new HashSet<>(task.getPartitionsV2());
retainedPartitions.retainAll(new HashSet<>(partitionMetadata.getPartitions()));
retainedPartitions.retainAll(partitionMetadata.getPartitions());
Copy link
Copy Markdown
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
Copy Markdown
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