-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Optimize kinesis ingestion task assignment after resharding #12235
Merged
kfaraz
merged 14 commits into
apache:master
from
AmatyaAvadhanula:feature-improve_kinesis_worker_assignment_after_resharding
Feb 18, 2022
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
dc96518
Optimize kinesis ingestion task assignment by considering only releva…
AmatyaAvadhanula f8dd11e
Refactor for better readability
AmatyaAvadhanula df9a72e
Move shard cache from KinesisRecordSupplier to KinesisSupervisor
AmatyaAvadhanula 7c708dd
Add KinesisRecordSupplier test
AmatyaAvadhanula 5311126
Add tests
AmatyaAvadhanula fde9873
Remove unnecessary import
AmatyaAvadhanula 2b1f4ad
Fix indentation
AmatyaAvadhanula 82a89a8
Minor refactoring
AmatyaAvadhanula 2353b97
Revert to previous indentation for unmodified code
AmatyaAvadhanula a1c5b1a
Address review comments and avoid reset in new tests
AmatyaAvadhanula 7239f05
Refactor tests and avoid unnecessary mocks, indenting changes
AmatyaAvadhanula 8908f87
Refactor tests and avoid unnecessary mocks
AmatyaAvadhanula b975f82
Synchronize the method to update the cache for closed shards
AmatyaAvadhanula 31fd84c
Rename method appropriately
AmatyaAvadhanula File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these be in thread-safe container, or have access be protected with lock?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing this out, @zachjsh.
This code would be executed by the
SeekableStreamSupervisor
while executing aRunNotice
(scheduled when status of a task changes) as well as aDynamicAllocationTasksNotice
(scheduled for auto-scaling). There is a possibility of contention between these two executions.We can make the part where the caches are updated
synchronized
.Just changing these two caches to a
Concurrent
version might not be enough as a whole new list of active shards is fetched inupdateClosedShardCache()
and the caches must be updated with this new state before any other action is performed.cc: @AmatyaAvadhanula
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Synchronizing the whole method
updateClosedShardCache
would actually be preferable because the state returned by two subsequent calls torecordSupplier.getShards()
can be different.So this call should happen inside the synchronized block, as should the calls to
recordSupplier.isClosedShardEmpty()
.I hope this doesn't cause bottlenecks though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whole method has been synchronized. Thanks!