Skip to content

MINOR: introduce structure to keep member assignment with topic Ids #19645

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

Merged
merged 4 commits into from
May 7, 2025

Conversation

lianetm
Copy link
Member

@lianetm lianetm commented May 5, 2025

  • Add new DS to wrap the member assignment (containing topic Ids, names
    and partitions), to easily access the data as needed. This will be used
    in following PR to integrate assignment with topic IDs into the
    subscription state.
  • Improve logging on the client assignment/reconciliation path

No changes in logic.

Reviewers: TengYao Chi [email protected], Andrew Schofield
[email protected]

Copy link
Contributor

@frankvicky frankvicky left a comment

Choose a reason for hiding this comment

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

@lianetm: Thanks for the enhancement!
Love this new structure 😸

}

/**
* Add a new topic (id+name) and partition. This will keep it, and also save references to the topic ID, topic name and partition,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* Add a new topic (id+name) and partition. This will keep it, and also save references to the topic ID, topic name and partition,
* Add a new topic (id+name) and partition. This will keep it, and also save references to the topic ID, topic name and partition.

Comment on lines 1443 to 1446
this.localEpoch = localEpoch;
this.partitions = new HashMap<>();
if (localEpoch == NONE_EPOCH && !topicIdPartitions.isEmpty()) {
throw new IllegalArgumentException("Local epoch must be set if there are partitions");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we consider checking the value before assigning it?

Copy link
Member

@AndrewJSchofield AndrewJSchofield left a comment

Choose a reason for hiding this comment

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

Thanks for the PR.

@@ -376,8 +370,8 @@ protected void processAssignmentReceived(Map<Uuid, SortedSet<Integer>> assignmen
*/
private void replaceTargetAssignmentWithNewAssignment(Map<Uuid, SortedSet<Integer>> assignment) {
currentTargetAssignment.updateWith(assignment).ifPresent(updatedAssignment -> {
log.debug("Target assignment updated from {} to {}. Member will reconcile it on the next poll.",
currentTargetAssignment, updatedAssignment);
log.debug("Member {} updated it's target assignment from {} to {}. Member will reconcile it on the next poll.",
Copy link
Member

Choose a reason for hiding this comment

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

nit: "its"

"be reconciled.", memberId, memberEpoch, MemberState.RECONCILING);
"to ack a previous reconciliation. \n" +
"\t\tCurrent assignment: {} \n" +
"\t\tNew assignment to reconcile: {}\n",
Copy link
Member

Choose a reason for hiding this comment

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

Any reason why this is not "Target assignment"? I wonder if there's a subtle difference that I've failed to grasp.

Copy link
Member Author

Choose a reason for hiding this comment

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

no reason, it's the Target assignment indeed. Fixed.

@lianetm
Copy link
Member Author

lianetm commented May 7, 2025

Thanks for the feedback @frankvicky / @AndrewJSchofield! All comments addressed.

@lianetm lianetm merged commit 67b46fe into apache:trunk May 7, 2025
24 checks passed
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