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-1353 + HSEARCH-1375 + HSEARCH-3110 Restore support for ErrorHandler (now FailureHandler) #2121

Merged
merged 36 commits into from Oct 17, 2019

Conversation

yrodiere
Copy link
Member

@yrodiere yrodiere commented Oct 11, 2019

Based on #2117 (HSEARCH-3736), which should be merged first. => Done

This moves the ErrorHandler to API, renames it to FailureHandler (see commit messages for an explanation), and brings a few changes aimed at improving the API, as well as removing a few bugs.

There are still a few issues which will be addressed in follow-up tickets; see the tickets linked from HSEARCH-1375.

Copy link
Contributor

@fax4ever fax4ever left a comment

Choose a reason for hiding this comment

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

I haven't found any significant issue and I think that we're doing amazing stuff.
I've only 3 comments over a nine-hours-long review!
IMHO, the exception handler, sorry the failure handler, is a very powerful tool now.
Great job and sorry again if I was very slow in reviewing it.

@yrodiere yrodiere removed the Waiting for other pull request Based on another PR that should be merged first label Oct 17, 2019
... and rename related concepts (ErrorContext, error_handler
configuration property, ...).

I used the term "Failure" because:

1. Exception isn't quite right, since we handle Throwables.
2. Error may incorrectly hint at java.lang.Error, and, again, we handle
Throwables.
3. Failure has the advantage of being relatively exempt of a precise
technical meaning.
We changed the APIs, these tags no longer make sense.
…perations

So it's really only used when there are index operations to mention. If
a background thread of the mapper were to fail, for example during mass
indexing, you would not get a call to handle(IndexFailureContext).
We're about to introduce more complexity with a type hierarchy,
so we better start from something simple.
Pass a context no matter what, just a different type of context
depending on the operation.
No need to make the FailureHandler API more complex just for this.
…Context.getUncommittedOperations()

... so that we can change "?" to a specific type later, without breaking
backward compatibility.
…r upon Lucene indexing failures

We used to only report works from the current workset after the one that
failed, but really the uncommitted works before the failing work may
also end up not being applied to the index, especially in case of commit
failure.

For example if we execute:

1. Workset 1: work 1, work 2 (commit strategy: no commit)
2. Workset 2: work 3, work 4, work 5 (commit strategy: no commit)

... and work 4 fails, then works 4 and 5 will obviously not be applied,
but work 1, 2, and 3 may end up not being applied either, depending on
the error, because we didn't commit them before the failure.
Currently it's not very important, since we would only have added the
exception as a suppressed exception to itself (weird, but not critical).
In the next commits, this will become an actual problem, because of how
we handle errors differently.
…ailure handler upon Elasticsearch indexing failures

1. Report one failure per failed work. We used to report one failure
with the first failed work as the "failing operation" and all other
works as simply "uncommitted operations", but that's wrong: in some
cases (bulk work failure) there are multiple failing works and the first
one is not more responsible of the failure than the others.
2. Blame uncommitted works on the first failed work in each sequence.
This is necessary now that we may report multiple failures per sequence.
It's no longer necessary, thanks to the changes in the last few commits.
…t code

This method wraps exceptions with CompletionException, which is generally
not what we want (we want the original exception).
…pletable futures or failure handlers

1. If we don't wrap the lambda passsed to exceptionally with
Futures.handler, we end up keeping the CompletionException wrapper in
the stack trace. That's really not necessary and makes us lose the
original exception message when we extract it through e.getMessage().
2. If we use expectRuntimeException instead of expectException, we end
up losing the original exception message if we extract it through
e.getMessage().
I want to add more features in there and the abstractions get in the
way.
... on a best-effort basis, because several things are quite hard to
assert.
…xpected exceptions

It's rather critical in this case, since the failure handler is called
in... failure handling code, where we usually don't expect another
failure.
@yrodiere yrodiere merged commit 70c6b9c into hibernate:master Oct 17, 2019
@yrodiere
Copy link
Member Author

Addressed your comments and merged, thanks!

@yrodiere yrodiere deleted the HSEARCH-3110 branch October 25, 2019 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants