-
Notifications
You must be signed in to change notification settings - Fork 15.4k
KAFKA-12495: IncrementalCooperativeAssignor#handleLostAssignments invokes logic for lost Assignments even when there are no Lost assignments #14000
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -151,7 +151,7 @@ public void testAssignmentsWhenWorkersJoinAfterRevocations() { | |
| // in this round | ||
| addNewEmptyWorkers("worker3"); | ||
| performStandardRebalance(); | ||
| assertTrue(assignor.delay > 0); | ||
| assertEquals(40, assignor.delay); // First successive revoking rebalance. | ||
| assertWorkers("worker1", "worker2", "worker3"); | ||
| assertConnectorAllocations(0, 1, 2); | ||
| assertTaskAllocations(3, 3, 6); | ||
|
|
@@ -161,30 +161,38 @@ public void testAssignmentsWhenWorkersJoinAfterRevocations() { | |
| time.sleep(assignor.delay); | ||
| addNewEmptyWorkers("worker4"); | ||
| performStandardRebalance(); | ||
| assertEquals(0, assignor.delay); // No revocations in this round. | ||
| assertWorkers("worker1", "worker2", "worker3", "worker4"); | ||
| assertConnectorAllocations(0, 0, 1, 1); | ||
| assertTaskAllocations(0, 3, 3, 3); | ||
|
|
||
| // Fifth assignment and a fifth worker joining after a revoking rebalance. | ||
| // We shouldn't revoke and set a delay > initial interval | ||
| // We shouldn't revoke and set a delay equal to initial interval | ||
| addNewEmptyWorkers("worker5"); | ||
| performStandardRebalance(); | ||
| assertTrue(assignor.delay > 40); | ||
| assertEquals(40, assignor.delay); // First successive revoking rebalance. | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO this happens because we weren't unsetting the counter when delay goes equal to 0. This is the first successive revoking rebalance and the delay should be 40. I say this because this case is similar to worker2 -> worker3 joining above where the delay was 40. It should be similar here as well. |
||
| assertWorkers("worker1", "worker2", "worker3", "worker4", "worker5"); | ||
| assertConnectorAllocations(0, 0, 1, 1, 1); | ||
| assertTaskAllocations(1, 2, 3, 3, 3); | ||
|
|
||
| // Sixth assignment with sixth worker joining after the expiry. | ||
| // Should revoke | ||
| time.sleep(assignor.delay); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I removed this to prove that the changes still work correctly and the delay gets extended further. |
||
| // Sixth assignment with sixth worker joining within rebalance interval | ||
| // There should not be any revocations and delay should be extended further. | ||
| addNewEmptyWorkers("worker6"); | ||
| performStandardRebalance(); | ||
| assertDelay(0); | ||
| assertTrue(assignor.delay > 40); // Second successive revoking rebalance. | ||
| assertWorkers("worker1", "worker2", "worker3", "worker4", "worker5", "worker6"); | ||
| assertConnectorAllocations(0, 0, 0, 1, 1, 1); | ||
| assertTaskAllocations(0, 1, 2, 3, 3, 3); | ||
|
|
||
| // Follow up rebalance after delay expires. | ||
| time.sleep(assignor.delay); | ||
| performStandardRebalance(); | ||
| assertEquals(0, assignor.delay); // Delay reset | ||
| assertWorkers("worker1", "worker2", "worker3", "worker4", "worker5", "worker6"); | ||
| assertConnectorAllocations(0, 0, 0, 1, 1, 1); | ||
| assertTaskAllocations(0, 1, 2, 2, 2, 2); | ||
|
|
||
| // Follow up rebalance since there were revocations | ||
| // Final rebalance because of revocations in the previous round | ||
| performStandardRebalance(); | ||
| assertWorkers("worker1", "worker2", "worker3", "worker4", "worker5", "worker6"); | ||
| assertConnectorAllocations(0, 0, 0, 1, 1, 1); | ||
|
|
||
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.
Added an elaborate check over here.