Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ public void dispose() throws Exception {
try {
cleanUp();
} catch (Exception ex) {
e = ExceptionUtils.firstOrSuppressed(ex, e);
e = ex;
}
}
{
Expand Down Expand Up @@ -442,7 +442,7 @@ private void cleanUp() {
try {
r.run();
} catch (Exception e) {
firstException = ExceptionUtils.firstOrSuppressed(firstException, e);
firstException = ExceptionUtils.firstOrSuppressed(e, firstException);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add some simple test for this bug?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It won't be reliable - the only difference will be in error message and stacktrace.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the only difference will be in error message and stacktrace.

Isn't that's the whole point of using firstOrSuppressed - to have the correct exception message?

Copy link
Contributor Author

@rkhachatryan rkhachatryan Feb 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we can have 100% coverage.
Here the fix is trivial, it's check is trivial, the importance is low, the test is relatively difficult (operator init with all the Task required) and un-reliable.

(also the edit above IMO shouldn't be covered)

Copy link
Contributor

@pnowojski pnowojski Feb 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential test doesn't look difficult:

@Test(expected = ExpectedTestException.class)
public void test() throws Exception {
	// duplicated setup code
	TextInputFormat format = new TextInputFormat(new Path(testBasePath)) {
		@Override
		public void close() {
			throw new ExpectedTestException();
		}
	};
	// more duplicated code that could be deduplicated
	try (OneInputStreamOperatorTestHarness<TimestampedFileInputSplit, String> tester = ...) {
		tester.open();
	}
}

It's also reliable, assuming we get rid of the FlinkRuntimeException wrapping, which looks unnecessary.

That's ~10 lines of simple code after deduplication?

Copy link
Contributor Author

@rkhachatryan rkhachatryan Feb 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It requires some more configuration like time characteristic and types.
I'm not saying it's not possible or difficult, I'm just saying it doesn't worth to have it.

}
}
currentSplit = null;
Expand Down