-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Allow BalanceStrategy to provide custom assignment data #1592
Conversation
The StickyBalanceStrategy currently provides state information with member assignments. This is achieved through a custom name check in the `syncGroupRequest` of the consumer group. This works well for this case, but falls apart when trying to create additional stateful balance strategies. This update will make it possible to create new stateful balance strategies
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 @aldelucca1
I've added one question.
Would be possible somehow to add a test for this in balance_strategy_test.go
?
consumer_group.go
Outdated
return nil, err | ||
} | ||
assignment.UserData = userDataBytes | ||
userDataBytes, err := strategy.AssignmentData(plan, memberID, generationID) |
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.
wondering why you'd need to send the plan and member to AssignmentData
to get the topics:
topics, ok := plan[memberID]
if !ok {
return nil, nil
}
if that was already obtained in the range above?
Line 335 for memberID, topics := range plan
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.
My thinking here was in the case the state being shipped needed to understand data about the larger plan, but I am happy limiting the scope to just the given member and its assigned topics.
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 fast response!
I'll 👀 later today
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
@bai could you please take another look at this?
Thanks
The StickyBalanceStrategy currently provides state information with member assignments. This is achieved through a custom name check in the
syncGroupRequest
of the consumer group. This works well for this case, but falls apart when trying to create additional stateful balance strategies. This update will make it possible to create new stateful balance strategies