chickenchickenlove commented on PR #23742:
URL: https://github.com/apache/kafka/pull/23742#issuecomment-6038379724

   @dajac 
   Thanks for the comments!  🙇‍♂️ 
   
   I’ve moved the defensive copy into the Assignment constructor so that 
assignments are immutable when created, and 
`MemberSubscriptionAndAssignmentImpl` now reuses them directly.
   
   As you mentioned, the additional copying could be expensive for large 
consumer groups. How about first using JFR to compare the previous approach 
with immutability enforced at assignment creation, varying the number of 
members, topics, and partitions to assess allocation overhead and processing 
time?
   
   If the overhead is still substantial, another option would be to document 
the read-only contract clearly in the assignor interfaces and require 
implementations to copy assignments before modifying them. That would avoid 
defensive copying, but would leave coordinator state vulnerable to accidental 
input mutation.
   
   What do you think? 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to