[
http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-601?pag...
]
Sanne Grinovero commented on HSEARCH-601:
-----------------------------------------
thinking more about it, having a threshold of "acceptable errors" seems
inconsistent, and complex: handling the errors makes sense, but pushing the responsibility
to the progress monitor doesn't.
So current behavior is to fail in case of errors, but being async this might not be
noticed by user code.
I'd propose to properly catch and log most RuntimeErrors errors, continuing the job
and logging each error.
Allow MassIndexer to recover gracefully when individual objects
won't index
---------------------------------------------------------------------------
Key: HSEARCH-601
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-601
Project: Hibernate Search
Issue Type: Improvement
Components: massindexer
Affects Versions: 3.2.0.Final
Environment: Hibernate 3.5.3, SQL Server 2005
Reporter: Ben Dotte
Assignee: Sanne Grinovero
Fix For: 3.3.0.Beta3
Some of our sites take hours to index, so it is critical that initial indexing complete
even if some of the individual entities fail to index properly. Right now, it appears that
the MassIndexer dies if any individual entity throws an exception during indexing, and
does not complete indexing for that type.
I have a workaround for now by overriding EntityConsumerLuceneworkProducer with my own
index() method that catches and logs exceptions from docBuilder.createAddWork():
private void index( Object entity, Session session ) throws InterruptedException {
Serializable id = session.getIdentifier( entity );
Class clazz = Hibernate.getClass( entity );
DocumentBuilderIndexedEntity docBuilder = documentBuilders.get( clazz );
TwoWayFieldBridge idBridge = docBuilder.getIdBridge();
String idInString = idBridge.objectToString( id );
//depending on the complexity of the object graph going to be indexed it's
possible
//that we hit the database several times during work construction.
try
{
AddLuceneWork addWork = docBuilder.createAddWork( clazz, entity, id, idInString, true
);
backend.enqueueAsyncWork( addWork );
}
catch (Exception e)
{
log.error("Error indexing " + clazz + " id " + id, e);
}
}
This has the added benefit that the object type and id that errored is logged, where that
can be tough to track down otherwise.
That may not be the best solution in general since it could hide exceptions from
Hibernate Search itself.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira