Skip to content

Conversation

@squah-confluent
Copy link
Contributor

@squah-confluent squah-confluent commented Dec 2, 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]

@github-actions github-actions bot added triage PRs from the community group-coordinator small Small PRs labels Dec 2, 2025
@dajac dajac added ci-approved and removed triage PRs from the community labels Dec 2, 2025
@dajac dajac self-requested a review December 2, 2025 17:20
/**
* The partition assignment for a modern group member.
*
* @param partitions The partitions assigned to this member keyed by topicId.
Copy link
Member

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.

Copy link
Contributor Author

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.
@airlock-confluentinc airlock-confluentinc bot force-pushed the squah-fix-assignor-regression branch from 77a6036 to a81daf5 Compare December 2, 2025 17:27
@squah-confluent squah-confluent requested a review from dajac December 2, 2025 18:03
@dajac
Copy link
Member

dajac commented Dec 3, 2025

@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?

@squah-confluent
Copy link
Contributor Author

squah-confluent commented Dec 3, 2025

I'd rather keep those tests in a separate PR.
Opened #21068 and #21069.

Copy link
Member

@dajac dajac left a comment

Choose a reason for hiding this comment

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

lgtm

@dajac dajac merged commit a9dff62 into apache:trunk Dec 3, 2025
24 checks passed
@dajac dajac deleted the squah-fix-assignor-regression branch December 3, 2025 14:07
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]>
@dajac
Copy link
Member

dajac commented Dec 3, 2025

Merged to trunk and 4.2.

@ijuma
Copy link
Member

ijuma commented Dec 6, 2025

The server-side assignors are designed to re-use the previous assignment
maps where possible and clone them for modification lazily.

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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants