MINOR: Catch NoRecordsException in testCommaSeparatedRegex() test#5944
Merged
ijuma merged 2 commits intoapache:trunkfrom Dec 8, 2018
stanislavkozlovski:mirror-maker-testCommaSeparatedRegex-test
Merged
MINOR: Catch NoRecordsException in testCommaSeparatedRegex() test#5944ijuma merged 2 commits intoapache:trunkfrom stanislavkozlovski:mirror-maker-testCommaSeparatedRegex-test
ijuma merged 2 commits intoapache:trunkfrom
stanislavkozlovski:mirror-maker-testCommaSeparatedRegex-test
Conversation
Now we properly wait until the timeout of `TestUtils.waitUntilTrue` passes until failing the test. Previously, Producer message sends and topic creations might some times take longer than the first 1s consumer poll
ijuma
reviewed
Nov 27, 2018
| // this exception is thrown if no record is returned within a short timeout, so safe to ignore | ||
| case _: TimeoutException => false | ||
| // these exceptions are thrown if no records are returned within the 1s timeout, so safe to ignore | ||
| case _: TimeoutException | _: NoRecordsException => false |
Member
There was a problem hiding this comment.
Also, we should not hardcode the timeout here as it will go stale if we change the MirrorMaker code.
Contributor
Author
There was a problem hiding this comment.
Nope, it is not thrown. Nice catch, I hadn't looked into it. TimeoutException is thrown on CommitSync and on ConsoleConsumer#receive(), but not on MirrorMakerConsumer#receive. Must be a left over
pengxiaolong
pushed a commit
to pengxiaolong/kafka
that referenced
this pull request
Jun 14, 2019
…ache#5944) This test sometimes fails with ``` kafka.tools.MirrorMaker$NoRecordsException at kafka.tools.MirrorMaker$ConsumerWrapper.receive(MirrorMaker.scala:483) at kafka.tools.MirrorMakerIntegrationTest$$anonfun$testCommaSeparatedRegex$1.apply$mcZ$sp(MirrorMakerIntegrationTest.scala:92) at kafka.utils.TestUtils$.waitUntilTrue(TestUtils.scala:738) ``` The test should catch `NoRecordsException` instead of `TimeoutException`. Reviewers: Ismael Juma <ismael@juma.me.uk>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This test sometimes fails with
It is a bit puzzling as to why this happens in the first place, as the producer call is synchronous and the consumer uses
auto.offset.reset=earliest, so it should always return records. But the test originally caughtTimeoutExceptionwith the comment// this exception is thrown if no record is returned within a short timeout, so safe to ignore, so I think that it is consistent to catch the other error when no records are returned such that we can retry until the test timeout is hitNow we properly wait until the timeout of
TestUtils.waitUntilTruepasses until failing the test.