KAFKA-20269: Refactor target assignment update for delayed assignments#21664
Open
squah-confluent wants to merge 1 commit intoapache:trunkfrom
Conversation
When assignment batching or assignment offload are implemented, the methods to update the target assignment will no longer always return a new target assignment, depending on timings and the group coordinator config.
Contributor
Author
|
@lucasbru Could you check the streams part of this change? |
lucasbru
reviewed
Mar 9, 2026
| @@ -3937,7 +3956,7 @@ private Assignment updateTargetAssignment( | |||
| * @param records The list to accumulate any new records. | |||
| * @return The new target assignment for the updated member, or EMPTY if no member specified. | |||
Member
There was a problem hiding this comment.
nit: do we not want to update the return javadocs? I suppose this goes to the next PR?
| returnedStatus.add( | ||
| new Status() | ||
| .setStatusCode(StreamsGroupHeartbeatResponse.Status.ASSIGNMENT_DELAYED.code()) | ||
| .setStatusDetail("Assignment delayed due to the configured initial rebalance delay.") |
Member
There was a problem hiding this comment.
I think we can also get here also if the initial assignment is offloaded. Should we reflect this in the status detail?
dajac
reviewed
Mar 9, 2026
| Optional<Assignment> updatedTargetAssignment = Optional.empty(); | ||
| if (groupEpoch > group.assignmentEpoch()) { | ||
| targetAssignment = updateTargetAssignment( | ||
| updatedTargetAssignment = maybeUpdateTargetAssignment( |
Member
There was a problem hiding this comment.
I wonder whether we should go a step further here. Have you considered pushing all the logic into maybeUpdateTargetAssignment? For instance, maybeUpdateTargetAssignment could return a record(epoch, assignment) and handle all the conditions that we have here. Thoughts?
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.
When assignment batching or assignment offload are implemented, the
methods to update the target assignment will no longer always return a
new target assignment, depending on timings and the group coordinator
config.