Skip to content

Commit

Permalink
HSEARCH-1562 Race condition in error reporting from IdentifierProducer
Browse files Browse the repository at this point in the history
Conflicts:
	engine/src/main/java/org/hibernate/search/util/logging/impl/Log.java
  • Loading branch information
Sanne committed Mar 31, 2014
1 parent d199fe1 commit 1fffa98
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Expand Up @@ -760,4 +760,8 @@ public interface Log extends BasicLogger {

@Message(id = 194, value = "Unable to load configured class '%s' as 'sharding_strategy'")
SearchException getUnableToLoadShardingStrategyClassException(String className);

@Message(id = 211, value = "An exception occurred while the MassIndexer was fetching the primary identifiers list")
String massIndexerExceptionWhileFetchingIds();

}
Expand Up @@ -62,6 +62,7 @@ public class IdentifierProducer implements StatelessSessionAwareRunnable {
private final MassIndexerProgressMonitor monitor;
private final long objectsLimit;
private final int idFetchSize;
private final ErrorHandler errorHandler;

/**
* @param fromIdentifierListToEntities the target queue where the produced identifiers are sent to
Expand All @@ -84,6 +85,7 @@ public IdentifierProducer(
this.indexedType = indexedType;
this.monitor = monitor;
this.objectsLimit = objectsLimit;
this.errorHandler = errorHandler;
this.idFetchSize = idFetchSize;
log.trace( "created" );
}
Expand All @@ -94,6 +96,9 @@ public void run(StatelessSession upperSession) throws Exception {
try {
inTransactionWrapper( upperSession );
}
catch (Exception exception) {
errorHandler.handleException( log.massIndexerExceptionWhileFetchingIds(), exception );
}
finally {
destination.producerStopping();
}
Expand Down
Expand Up @@ -55,7 +55,7 @@ public void testSetFetchSizeOnH2Fails() throws InterruptedException {

getSession().close();
String errorMessage = mockErrorHandler.getErrorMessage();
Assert.assertEquals( "HSEARCH000116: Unexpected error during MassIndexer operation", errorMessage );
Assert.assertEquals( "HSEARCH000211: An exception occurred while the MassIndexer was fetching the primary identifiers list", errorMessage );
Throwable exception = mockErrorHandler.getLastException();
Assert.assertTrue( exception instanceof org.hibernate.exception.GenericJDBCException );
}
Expand Down

0 comments on commit 1fffa98

Please sign in to comment.