KAFKA-9821: persist followup rebalance in assignment and consolidate rebalance triggering mechanisms#8596
Conversation
|
Kicked off the version probing system test since I'm mucking around in the rebalance triggering code and log messages, and I've broken it that way before 😅 : https://jenkins.confluent.io/job/system-test-kafka-branch-builder/3926/ edit: yup, broke the version probing test. Investigation ongoing |
|
Also cc @mjsax for some feedback on making the rebalancing comprehensible in system test logs |
There was a problem hiding this comment.
We lose information here, but now log the reason for the scheduled rebalance in a (hopefully) more clear way during onAssignment
There was a problem hiding this comment.
Previously we were doing this logging at the client-level, meaning we could end up in the confusing situation of logging Stable rebalance.. for one client and Unstable rebalance... for another, all in the same rebalance. Now we only log the final result after all client assignments are encoded, and log which clients actually are scheduling said rebalance at the debug level.
There was a problem hiding this comment.
This encodes an immediate followup rebalance for the consumer who would be receiving the revoked tasks. The consumer that is doing the revoking will also request a followup rebalance (in the client code) but due to KAFKA-9821 this cannot be relied upon when static membership is used.
There was a problem hiding this comment.
This is now the only usage of the assignment error code
There was a problem hiding this comment.
Here we check for and log all the possible reasons for a followup rebalance to be scheduled on this consumer. It should be clear whether (and why) a rebalance is required by looking at the logs of either the group leader or the member(s) requesting the rebalance.
|
Retest this please. |
|
Version probing test passing locally now, kicked off a branch builder to confirm: https://jenkins.confluent.io/job/system-test-kafka-branch-builder/3927/ |
|
System test run passed (as did all three builds, wow!) |
vvcephei
left a comment
There was a problem hiding this comment.
LGTM (just the one minor comment about the config key, above)
Waiting for @mjsax to take a look also.
Thanks, @ableegoldman !
24e2f77 to
39ea82c
Compare
39ea82c to
eb206b8
Compare
|
Kicking off the version probing system test again after rebasing on top of Bruno's changes/fix (because I can't run it locally again... 😕 ) -- https://jenkins.confluent.io/job/system-test-kafka-branch-builder/3934/ |
|
test this please |
1 similar comment
|
test this please |
|
Messed up the system test logs during the rebase, kicked off a new version probing test: https://jenkins.confluent.io/job/system-test-kafka-branch-builder/3935 edit: system test passed |
|
test this please |
2 similar comments
|
test this please |
|
test this please |
|
Hey @ableegoldman , there were a bunch of failures: Do you think those are related? |
|
Yeah, I just saw...honestly I'm not sure what to conclude here since all of them did pass at least once, and all of the failed tests are known to be flaky. But it does seem to be a higher-than-normal failure rate so I'm investigating |
|
@vvcephei Yeah I can locally reproduce the Not sure what's up with |
|
Oh hm actually I can't seem to reproduce it on trunk anymore, at least not as frequently as on this branch. Maybe we should block merging this PR until we have the test hook in place |
|
retest this please |
|
No harm in trying again :) |
|
test this please |
1 similar comment
|
test this please |
|
retest this please |
* 'trunk' of github.com:apache/kafka: MINOR: add option to rebuild source for system tests (apache#6656) KAFKA-9850 Move KStream#repartition operator validation during Topolo… (apache#8550) MINOR: Add a duplicate() method to Message classes (apache#8556) KAFKA-9966: add internal assignment listener to stabilize eos-beta upgrade test (apache#8648) MINOR: Replace null with an actual value for timestamp field in InsertField SMT unit tests (apache#8649) MINOR: Fix ProcessorContext JavaDocs and stream-time computation (apache#8603) MINOR: improve tests for TopologyTestDriver (apache#8631) KAFKA-9821: consolidate Streams rebalance triggering mechanisms (apache#8596) KAFKA-9669; Loosen validation of inner offsets for older message formats (apache#8647) KAFKA-8770: KIP-557: Drop idempotent KTable source updates (apache#8254) MINOR: Remove allow concurrent test (apache#8641)
…he#8596) Persist followup rebalance in assignment and consolidate rebalance triggering mechanisms Reviewers: John Roesler <vvcephei@apache.org>
…he#8596) Persist followup rebalance in assignment and consolidate rebalance triggering mechanisms Reviewers: John Roesler <vvcephei@apache.org>
This patch fixes KAFKA-9821 for Streams by persisting the required rebalance in the assignment. If a member fails and restarts it will receive its last assignment and notify the thread to trigger a new rebalance, even with static membership.
Note: in the consumer client, the member who has to revoke some partitions is responsible for triggering the followup rebalance. Here we are actually encoding the required rebalance for the member who was supposed to receive these partitions. Since this only signals to the client to request a rebalance upon the next poll in both cases, and the rebalance schedule is reset in
onAssignment, this should not result in extra (unnecessary) rebalances even if one member lags the other in requesting this.This patch also consolidates the two rebalancing triggering mechanisms currently used by the Streams partition assignor: the
AssignorErrorand the newly introducednextScheduleRebalanceMs. Since the latter encompasses the former, we can remove theREBALANCE_NEEDEDassignor error and just schedule the next rebalance for0Lms to trigger it immediately. This has the nice side effect of removing the only recoverable AssignorError, so we no longer have to worry about handling this error and can just assume it to be fatal and shut down.