Skip to content

KAFKA-20269 [3/N]: Refactor assignment update for delayed streams assignments#21696

Open
squah-confluent wants to merge 5 commits intoapache:trunkfrom
confluentinc:squah-kip-1263-refactor-target-assignment-update-for-delayed-assignments-streams
Open

KAFKA-20269 [3/N]: Refactor assignment update for delayed streams assignments#21696
squah-confluent wants to merge 5 commits intoapache:trunkfrom
confluentinc:squah-kip-1263-refactor-target-assignment-update-for-delayed-assignments-streams

Conversation

@squah-confluent
Copy link
Contributor

@squah-confluent squah-confluent commented Mar 10, 2026

Refactor the streams target assignment update method to return both the
target assignment epoch and target assignment. When assignment batching
or assignment offload are implemented, the target assignment update
method may return the last target assignment, depending on timings and
the group coordinator config.

Reviewers: Lucas Brutschy lbrutschy@confluent.io, David Jacot
djacot@confluent.io

@github-actions github-actions bot added triage PRs from the community group-coordinator labels Mar 10, 2026
@airlock-confluentinc airlock-confluentinc bot force-pushed the squah-kip-1263-refactor-target-assignment-update-for-delayed-assignments-streams branch from 3aaad34 to 49d7ae8 Compare March 10, 2026 12:32
@squah-confluent
Copy link
Contributor Author

cc @lucasbru

@dajac dajac added ci-approved and removed triage PRs from the community labels Mar 10, 2026
Comment on lines +287 to +289
if (member.get().instanceId().isPresent()) {
throw new UnsupportedOperationException("Static members are not supported yet.");
}
Copy link
Member

Choose a reason for hiding this comment

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

This is not present in the previous code. What's the rational for adding it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was concerned that we would forget to update this method since #21565 is already in flight. But looking at that PR, we should have a merge conflict which is enough.

@squah-confluent squah-confluent changed the title KAFKA-20269: Refactor assignment update for delayed streams assignments KAFKA-20269 [3/N]: Refactor assignment update for delayed streams assignments Mar 10, 2026
@airlock-confluentinc airlock-confluentinc bot force-pushed the squah-kip-1263-refactor-target-assignment-update-for-delayed-assignments-streams branch 2 times, most recently from 98e51ff to 1e14359 Compare March 10, 2026 15:28
@github-actions github-actions bot added the small Small PRs label Mar 10, 2026
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. @lucasbru Could you please check it too?

@dajac
Copy link
Member

dajac commented Mar 10, 2026

@squah-confluent Could you please rebase?

Refactor the streams target assignment update method to return both the
target assignment epoch and target assignment. When assignment batching
or assignment offload are implemented, the target assignment update
method may return the last target assignment, depending on timings and
the group coordinator config.
@airlock-confluentinc airlock-confluentinc bot force-pushed the squah-kip-1263-refactor-target-assignment-update-for-delayed-assignments-streams branch from 1e14359 to 8017f23 Compare March 10, 2026 18:31
@squah-confluent
Copy link
Contributor Author

Rebased

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

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

Copy link
Member

@lucasbru lucasbru left a comment

Choose a reason for hiding this comment

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

Two questions, otherwise lgtm


return new UpdateTargetAssignmentResult<>(
Math.max(1, group.assignmentEpoch()),
updatedMember.map(member -> group.targetAssignment(member.memberId()))
Copy link
Member

Choose a reason for hiding this comment

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

Not sure why we are not returning TasksTuple.EMPTY here. Effect should be the same though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed it, thanks!

Optional<List<Status>> returnedStatus,
Map<String, String> assignmentConfigs
) {
boolean initialDelayActive = timer.isScheduled(streamsInitialRebalanceKey(group.groupId()));
Copy link
Member

Choose a reason for hiding this comment

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

In the new code this will be called when the timer expires. Will timer.isScheduled be false then?

Copy link
Contributor Author

@squah-confluent squah-confluent Mar 11, 2026

Choose a reason for hiding this comment

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

I think it's fine since the timer will be removed from the set of timer tasks before we get here:

if (!tasks.remove(key, this)) {
throw new RejectedExecutionException("Timer " + key + " was overridden or cancelled");
}
// Execute the timeout operation.
return operation.generateRecords();

and isScheduled checks that set of tasks:

public boolean isScheduled(String key) {
return tasks.containsKey(key);
}

@dajac
Copy link
Member

dajac commented Mar 11, 2026

@squah-confluent Is it safe to merge this one?

Copy link
Member

@lucasbru lucasbru left a comment

Choose a reason for hiding this comment

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

lgtm!

…tor-target-assignment-update-for-delayed-assignments-streams
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