KAFKA-19955: Fix performance regression in server-side assignors#21058
Merged
dajac merged 2 commits intoapache:trunkfrom Dec 3, 2025
Merged
KAFKA-19955: Fix performance regression in server-side assignors#21058dajac merged 2 commits intoapache:trunkfrom
dajac merged 2 commits intoapache:trunkfrom
Conversation
dajac
reviewed
Dec 2, 2025
| /** | ||
| * The partition assignment for a modern group member. | ||
| * | ||
| * @param partitions The partitions assigned to this member keyed by topicId. |
Member
There was a problem hiding this comment.
Let's expand the comment here too.
Contributor
Author
There was a problem hiding this comment.
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
Member
|
@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? |
Contributor
Author
dajac
pushed a commit
that referenced
this pull request
Dec 3, 2025
) 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]>
Member
|
Merged to trunk and 4.2. |
Member
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. |
shashankhs11
pushed a commit
to shashankhs11/kafka
that referenced
this pull request
Dec 15, 2025
…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]>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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]