Improve error handling

Description

Currently it's possible to set an error handler at search integration level, by using the property hibernate.search.error_handler pointing to a implementation class. The error handler is a callback that presents the exception and an org.hibernate.search.exception.ErrorContext that contains the works that failed and the Throwable

On a particular Infinispan index manager, sometimes it may be desirable to retry some indexing operations when a particular exception happens in the backend, and the current mechanism poses some challenges:

  • The error handler is at SearchIntegrator level, so all shards (index managers) share the same error handler;

  • There's no indication of which index manager that the error occurred;

  • It's not possible to compose multiple error handlers into one, which would allow to first do a RetryErrorHandler and then delegate it to the LogErrorHandler if it fails.

Environment

None

Activity

Show:
Sanne Grinovero
November 2, 2016, 10:18 AM

We could add more context to org.hibernate.search.exception.ErrorContext; specifically we could add:

  • String getIndexManagerName();

  • String getShardIdentifier();

The shardname method is redundant as it could be inferred from the IndexManager name, but I guess it could be useful. Would these help for your use case?
Would you rather need a reference to the IndexManager instance, or a reference to other backend components?

I'm not sure what you mean by "It's not possible to compose multiple error handlers into one". Is something preventing you from creating a composite implementation, or is it that you'd expect to be able to provide multiple of them and have the search-engine facilitate the composition?

Gustavo Fernandes
November 2, 2016, 10:31 AM

IndexMamanager getIndexManager(); would be ideal, as it contains the other attributes you mentioned.

I'm not sure what you mean by "It's not possible to compose multiple error handlers into one"

I meant the engine does not offer composition support for multiple error handlers, Index Manager implementors and users need to compose themselves, potentially wrapping the default logging error handler but adding another behaviours. I'd say this is minor though, the important thing is having more feedback about the error.

Assignee

Gustavo Fernandes

Reporter

Gustavo Fernandes

Labels

None

Suitable for new contributors

None

Feedback Requested

None

Components

Fix versions

Affects versions

Priority

Major
Configure