-
Notifications
You must be signed in to change notification settings - Fork 14.8k
KAFKA-7195: Fix StreamStreamJoinIntegrationTest test failures #5418
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
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -274,6 +274,24 @@ public void deleteTopicsAndWait(final long timeoutMs, final String... topics) th | |
| } | ||
| } | ||
|
|
||
| /** | ||
| * Deletes all topics and blocks until all topics got deleted. | ||
| * | ||
| * @param timeoutMs the max time to wait for the topics to be deleted (does not block if {@code <= 0}) | ||
| */ | ||
| public void deleteAllTopicsAndWait(final long timeoutMs) throws InterruptedException { | ||
| final Set<String> topics = new HashSet<>(JavaConverters.seqAsJavaListConverter(zkUtils.getAllTopics()).asJava()); | ||
| for (final String topic : topics) { | ||
| try { | ||
| brokers[0].deleteTopic(topic); | ||
| } catch (final UnknownTopicOrPartitionException e) { } | ||
|
Contributor
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. Should the exception be logged ? |
||
| } | ||
|
|
||
| if (timeoutMs > 0) { | ||
|
Contributor
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. Should timeout be re-calculated considering the for loop above ? |
||
| TestUtils.waitForCondition(new TopicsDeletedCondition(topics), timeoutMs, "Topics not deleted after " + timeoutMs + " milli seconds."); | ||
| } | ||
| } | ||
|
|
||
| public void deleteAndRecreateTopics(final String... topics) throws InterruptedException { | ||
| deleteTopicsAndWait(TOPIC_DELETION_TIMEOUT, topics); | ||
| createTopics(topics); | ||
|
|
@@ -295,6 +313,10 @@ private TopicsDeletedCondition(final String... topics) { | |
| Collections.addAll(deletedTopics, topics); | ||
| } | ||
|
|
||
| public TopicsDeletedCondition(final Set<String> topics) { | ||
| deletedTopics.addAll(topics); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean conditionMet() { | ||
| final Set<String> allTopics = new HashSet<>( | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can you elaborate why this fixed the test?
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.
I'm not 100 percent sure what's the race condition here, and why it fixes the test.
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.
To be frank, I am not sure about the root-cause. Parameterized StreamStreamJoinIntegrationTest tests are passing for
cacheEnabled=trueand intermittently failing for parametercacheEnabled=false.I thought we may not be cleaning some intermediate topics/change-log/? topics between parameterized runs. So I tried deleting all topics including offsets topics. With this I am not able to reproduce the failures.
I may be totally wrong. I'll spend some more time to understand the tests and debug the issue.
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.
@omkreddy Were you be able to reproduce the issue locally before this PR?
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.
Yes, I am able to reproduce the failures on my machine.
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.
It seems we are using the same application id twice in
StreamStreamJoinIntegartionTestThis might be the root case -- deleting all topics would solve the issue, too, as it prevent to start with a corrupted state.
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.
I seems that
TableTableJoinIntegrationTesthas a similar issue...Uh oh!
There was an error while loading. Please reload this page.
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.
Ok.. Yes, I have observed failures with TableTableJoinIntegrationTest too. Shall I update the appId?
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.
One thing I can think of is that the changelog topic of the joining streams's materialized stores were not deleted, and hence upon starting on the next test case, the store would be pre-populated and hence cause join result to be wrong (note that the state dir is a
@Rulewhich means it will get cleaned up on each test case, and in the next run it will not be the same directory path).And the reason that it does not always fail is that we have to hit it that the two tests (with and without caching) consecutively.
So think with your fix in
2.0andtrunk, it is Okay to leave the appID as is for now.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.
Just ran some more tests locally to confirm my suspicion.