KAFKA-9966: add internal assignment listener to stabilize eos-beta upgrade test#8648
Conversation
|
Will need to be rebased once pull/8596 is merged, but the PR is ready. Reduced the nearly 100% failure rate of this test on top of the changes in pull/8596 to 0% (that I've seen so far 🙂) @mjsax @vvcephei edit: this PR alone does not contain all the fixes needed for the eos-beta upgrade test, so I'm leaving it ignored for now. The other set of fixes are included in #8662 We can remove the Ignore annotation in whichever PR gets merged last |
58f5eb2 to
c033c3c
Compare
There was a problem hiding this comment.
Why do we use getLogPrefix() -- our code style always omit the get prefix -- should be just logPrefix() (Similar below for other methods)
There was a problem hiding this comment.
I guess I thought there was a reason getXX was used in this class and figured all the methods should conform. Idk. I'll remove the get
c033c3c to
276aae8
Compare
276aae8 to
37bf2a6
Compare
| } | ||
| } | ||
|
|
||
| public AssignmentListener assignmentListener() { |
There was a problem hiding this comment.
This is the only non-cosmetic change in this class, along with the interface added below
| private final org.apache.kafka.streams.processor.PartitionGrouper partitionGrouper; | ||
| private final String userEndPoint; | ||
| private final TaskManager taskManager; | ||
| private final StreamsMetadataState streamsMetadataState; |
There was a problem hiding this comment.
Sorry for all the lines of changes here, but the inconsistent method signatures and object construction was making this class hard to follow. All I'm doing here is making the methods conform to the same style, and moving the construction of any config that isn't needed elsewhere to its getter method. This allows us to remove a lot of these class variables
There was a problem hiding this comment.
Do we know if the corresponding "getters" are called often or not? I guess the main idea behind having those member variables was to "parse" the config once as it's immutable anyway instead of each time a getter is called?
There was a problem hiding this comment.
They are not. We construct the AssignorConfiguration object once in StreamsPartitionAssignor#configure and call the getters immediately afterwards, and only there
| final List<KeyValue<KafkaStreams.State, KafkaStreams.State>> expected) | ||
| throws Exception { | ||
|
|
||
| private void waitForRunning(final List<KeyValue<KafkaStreams.State, KafkaStreams.State>> observed) throws Exception { |
There was a problem hiding this comment.
This one actually might not be necessary, but I thought it was useful as a sanity check especially since we're trying to access the stores in some places
| private final org.apache.kafka.streams.processor.PartitionGrouper partitionGrouper; | ||
| private final String userEndPoint; | ||
| private final TaskManager taskManager; | ||
| private final StreamsMetadataState streamsMetadataState; |
There was a problem hiding this comment.
Do we know if the corresponding "getters" are called often or not? I guess the main idea behind having those member variables was to "parse" the config once as it's immutable anyway instead of each time a getter is called?
| final List<KeyValue<KafkaStreams.State, KafkaStreams.State>> expected) | ||
| throws Exception { | ||
|
|
||
| private void waitForRunning(final List<KeyValue<KafkaStreams.State, KafkaStreams.State>> observed) throws Exception { |
| private void waitForRunning(final List<KeyValue<KafkaStreams.State, KafkaStreams.State>> observed) throws Exception { | ||
| waitForCondition( | ||
| () -> observed.equals(expected), | ||
| () -> observed.get(observed.size() - 1).equals(new KeyValue<>(State.REBALANCING, State.RUNNING)), |
There was a problem hiding this comment.
Seems this could fail if observed is empty?
Also, could we simplify this? We are only interested in RUNNING state, right? So no need to check the previous state?
There was a problem hiding this comment.
True, I'll fix this
|
|
||
| @Test | ||
| public void shouldThrowExceptionIfApplicationServerConfigPortIsNotAnInteger() { | ||
| createDefaultMockTaskManager(); |
There was a problem hiding this comment.
If we don't configure the TaskManager then we'll throw (the wrong kind of) exception during configure. Previously this test just happened to pass because we processed the user endpoint before we processed the TaskManager, so we never got to the TaskManager
| KeyValue.pair(KafkaStreams.State.REBALANCING, KafkaStreams.State.RUNNING) | ||
| ) | ||
| ); | ||
| assignmentListener.waitForNextStableAssignment(expectedNumStableAssignments, MAX_WAIT_TIME_MS); |
There was a problem hiding this comment.
So far we always pass in assignmentListener.numStableAssignments() + 1 -- hence, I am wondering if we need to pass it at all?
There was a problem hiding this comment.
Well we need to record it before doing whatever action causes the group to rebalance. But maybe we can do something like prepareForRebalance if that seems easier?
|
Retest this please. |
|
Retest this please. |
1 similar comment
|
Retest this please. |
|
Java 14 passed, Java 8 build failed due to mysterious |
* '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)
…grade test (apache#8648) Reviewer: Matthias J. Sax <matthias@confluent.io>
Adds an internal assignment listener interface with a callback that exposes the assignment stability. A useful implementation that tracks the number of stable assignments is available in IntegrationTestUtils, and leveraged to fix the flaky EOSBetaUpgradeTest, but any implementation can be plugged in to meet the specific needs of a test.