Skip to content
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

HSEARCH-3864 java.lang.Error thrown during mass indexing are swallowed and not reported to the user #2349

Merged
merged 7 commits into from
Sep 8, 2020

Conversation

fax4ever
Copy link
Contributor

@fax4ever fax4ever commented Sep 4, 2020

https://hibernate.atlassian.net/browse/HSEARCH-3864

There is some code duplication.
I tried also to make [Make *MassIndexingFailureIT parametric] (fax4ever@0988a4e) as alternative...

@fax4ever fax4ever assigned fax4ever and unassigned fax4ever Sep 7, 2020
Copy link
Member

@yrodiere yrodiere left a comment

Choose a reason for hiding this comment

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

Thanks.

There seems to be some problems in the tests. Please fix that first?

@@ -650,7 +610,7 @@ private SessionFactory setup() {
private enum ExecutionExpectation {
SUCCEED,
FAIL,
SKIP;
ERROR;
Copy link
Member

Choose a reason for hiding this comment

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

This is odd. I'd expect you would replace FAIL and maybe remove SKIP... but FAIL is apparently still used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the current behavior:

AbstractMassIndexingErrorIT AbstractMassIndexingFailureIT
indexingAndFlush FAIL FAIL
indexingAndRefresh FAIL FAIL
flush FAIL FAIL
getId ERROR SKIP
purge FAIL FAIL
indexing FAIL FAIL
refresh FAIL FAIL
dropAndCreateSchema_exception FAIL FAIL
mergeSegmentsAfter FAIL FAIL
mergeSegmentsBefore FAIL FAIL
getTitle ERROR SKIP

AbstractMassIndexingErrorIT behaves as AbstractMassIndexingFailureIT for all the cases with the exception of getId and getTitle.
That sounds reasonable to me. If it doesn't sound good for you, what would be the expected behavior?

reset( failureHandler );
failureHandler.handle( capture( entityFailureContextCapture ) );
failureHandler.handle( capture( genericFailureContextCapture ) );
failureHandler.handle( capture( genericFailureContextCapture ) );
Copy link
Member

Choose a reason for hiding this comment

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

If you're going to use the capture like this, you should make it multi-valued to run assertions on all the captured values. i.e. use org.easymock.EasyMock#newCapture(org.easymock.CaptureType) to create the Capture object.


import org.junit.Rule;

public class MassIndexingFailureCustomBackgroundErrorHandlerIT extends AbstractMassIndexingErrorIT {
Copy link
Member

Choose a reason for hiding this comment

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

The name of this class looks wrong. It tests behavior when errors occur during mass indexing, with a custom background failure handler. So it should be MassIndexingErrorCustomBackgroundFailureHandlerIT.

import org.easymock.EasyMock;
import org.hamcrest.MatcherAssert;

public class MassIndexingFailureCustomMassIndexingErrorHandlerIT extends AbstractMassIndexingErrorIT {
Copy link
Member

Choose a reason for hiding this comment

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

The name of this class looks wrong. It tests behavior when errors occur during mass indexing, with a custom mass indexing failure handler. So it should be MassIndexingErrorCustomMassIndexingFailureHandlerIT.


import org.apache.log4j.Level;

public class MassIndexingFailureDefaultBackgroundErrorHandlerIT extends AbstractMassIndexingErrorIT {
Copy link
Member

Choose a reason for hiding this comment

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

The name of this class looks wrong. It tests behavior when errors occur during mass indexing, with the default background failure handler. So it should be MassIndexingErrorDefaultBackgroundFailureHandlerIT.

Copy link
Member

@yrodiere yrodiere left a comment

Choose a reason for hiding this comment

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

See my comments below.

  1. The equals/hashcode are probably not a great idea.
  2. The duplicated report of the error looked weird. I pushed a few commits to simplify reporting of errors: they are just propagated as-is. Please let me know what you think.

@yrodiere
Copy link
Member

yrodiere commented Sep 8, 2020

I added a few commits to simplify how Errors are reported: we will just propagate them and won't attempt to report them to the failure handlers.
After some discussion on Zulip, we'll go that way.
Let's merge once the build passes.

@sonarcloud
Copy link

sonarcloud bot commented Sep 8, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 4 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@yrodiere yrodiere merged commit 2ed7e50 into hibernate:master Sep 8, 2020
@yrodiere
Copy link
Member

yrodiere commented Sep 8, 2020

Merged, thanks!

@fax4ever fax4ever deleted the HSEARCH-3864 branch September 8, 2020 12:24
@fax4ever
Copy link
Contributor Author

fax4ever commented Sep 8, 2020

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants