[hibernate-issues] [Hibernate-JIRA] Updated: (HSEARCH-601) Allow MassIndexer to recover gracefully when individual objects won't index

Emmanuel Bernard (JIRA) noreply at atlassian.com
Wed Dec 8 05:16:23 EST 2010


     [ http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-601?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Bernard updated HSEARCH-601:
-------------------------------------

    Fix Version/s:     (was: 3.3.0.CR2)
                   3.4.0

> 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.4.0
>
>
> 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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list