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
KAFKA-16261: updateSubscription fails if already empty subscription #15440
Conversation
@AndrewJSchofield could you have a look, since you created the ticket? I wasn't quite sure in which sequence of events to observed the problem. The unit test emulates clearing the assignment while leave group is in progress. |
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
@lucasbru Unit tests are failing in |
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 PR, @lucasbru !
Here my feedback.
As I said earlier some unit tests fail consistently.
@@ -764,6 +766,44 @@ public void testLeaveGroupWhenMemberOwnsAssignment() { | |||
testLeaveGroupReleasesAssignmentAndResetsEpochToSendLeaveGroup(membershipManager); | |||
} | |||
|
|||
@Test | |||
public void testLeaveGroupWhenAssignmentEmpty() { |
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.
Is there maybe a more direct way to test the bug?
I had a hard time to understand this unit test.
Nevermind if there is no more direct way.
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.
Replaced it by a simpler test
// Complete the callback | ||
callbackEvent.future().complete(null); | ||
|
||
// Completed the listener |
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.
This comment does not make too much sense since the leave future is still verified to be not completed.
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.
Done
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 @lucasbru !
LGTM!
…y empty subscription The internal SubscriptionState object keeps track of whether the assignment is user-assigned, or auto-assigned. If there are no assigned partitions, the assignment resets to NONE. If you call SubscriptionState.assignFromSubscribed in this state it fails. This change makes sure to check SubscriptionState.hasAutoAssignedPartitions() so that assignFromSubscribed is going to be permitted. Also a minor refactoring to make clearing the subscription a bit easier to follow in MembershipManagerImpl.
651e244
to
f177084
Compare
…pache#15440) The internal SubscriptionState object keeps track of whether the assignment is user-assigned, or auto-assigned. If there are no assigned partitions, the assignment resets to NONE. If you call SubscriptionState.assignFromSubscribed in this state it fails. This change makes sure to check SubscriptionState.hasAutoAssignedPartitions() so that assignFromSubscribed is going to be permitted. Also, a minor refactoring to make clearing the subscription a bit easier to follow in MembershipManagerImpl. Testing via new unit test. Reviewers: Bruno Cadonna <cadonna@apache.org>, Andrew Schofield <aschofield@confluent.io>
The internal SubscriptionState object keeps track of whether the assignment is user-assigned, or auto-assigned. If there are no assigned partitions, the assignment resets to NONE. If you call SubscriptionState.assignFromSubscribed in this state it fails.
This change makes sure to check SubscriptionState.hasAutoAssignedPartitions() so that assignFromSubscribed is going to be permitted.
Also, a minor refactoring to make clearing the subscription a bit easier to follow in MembershipManagerImpl.
Testing via new unit test.
Committer Checklist (excluded from commit message)