-
Notifications
You must be signed in to change notification settings - Fork 14.8k
KAFKA-19955: Fix performance regression in server-side assignors #21058
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-19955: Fix performance regression in server-side assignors #21058
Conversation
| /** | ||
| * The partition assignment for a modern group member. | ||
| * | ||
| * @param partitions The partitions assigned to this member keyed by topicId. |
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.
Let's expand the comment here too.
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 the review. I tried to expand the javadoc.
The server-side assignors are designed to re-use the previous assignment maps where possible and clone them for modification lazily. apache#20097 introduced a bug where the assignments would always be re-wrapped in an unmodifiable map and so we would end up cloning them repeatedly in the assignors when multiple changes need to be made to a member assignment. Fix the bug by removing the unmodifiable map wrapping.
77a6036 to
a81daf5
Compare
|
@squah-confluent I wonder whether we could add tests for all the assignors to ensure that they actually preserve input maps if there are no changes. It would be better to avoid any future regression. What do you think? |
dajac
left a comment
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.
lgtm
) The server-side assignors are designed to re-use the previous assignment maps where possible and clone them for modification lazily. #20097 introduced a bug where the assignments would always be re-wrapped in an unmodifiable map and so we would end up cloning them repeatedly in the assignors when multiple changes need to be made to a member assignment. Fix the bug by removing the unmodifiable map wrapping. Reviewers: David Jacot <[email protected]>
|
Merged to trunk and 4.2. |
Looks like the mechanism we use to decide if a map should be cloned is brittle. Perhaps, it should be a more explicit mechanism so these kinds of bugs are not possible. |
…che#21058) The server-side assignors are designed to re-use the previous assignment maps where possible and clone them for modification lazily. apache#20097 introduced a bug where the assignments would always be re-wrapped in an unmodifiable map and so we would end up cloning them repeatedly in the assignors when multiple changes need to be made to a member assignment. Fix the bug by removing the unmodifiable map wrapping. Reviewers: David Jacot <[email protected]>
The server-side assignors are designed to re-use the previous assignment
maps where possible and clone them for modification lazily. #20097
introduced a bug where the assignments would always be re-wrapped in an
unmodifiable map and so we would end up cloning them repeatedly in the
assignors when multiple changes need to be made to a member assignment.
Fix the bug by removing the unmodifiable map wrapping.
Reviewers: David Jacot [email protected]