0

我有一个问题,通过休眠搜索重新创建一个完整的索引来搜索一个包含大约 45000 个条目的大数据表。

我有什么方法可以修改以下代码?

@Transactional
    public void rebuildIndex(){
        logDebug("Start rebuilding full index");
        FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager(entityManager);
        try {
            fullTextEntityManager.createIndexer().startAndWait();
            logDebug("Finished rebuilding full index");
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

[编辑] 这里有更多信息。

大约 5 分钟后,我收到一个错误,因为没有交易处于活动状态。

首先一切都在运行:

INFO 2013-11-11 09:36:36,356 [SimpleIndexingProgressMonitor] HSEARCH000030: 132200 documents indexed in 298782 ms  
INFO 2013-11-11 09:36:36,356 [SimpleIndexingProgressMonitor] HSEARCH000031: Indexing speed: 442,463074 documents/second; progress: 30,66%  

然后出现警告

WARN 2013-11-11 09:36:36,399 [arjuna] ARJUNA012117: TransactionReaper::check timeout for TX 0:ffff91e40e22:-2eab8f02:5280958c:b1 in state  RUN  
WARN 2013-11-11 09:36:36,400 [arjuna] ARJUNA012117: TransactionReaper::check timeout for TX 0:ffff91e40e22:-2eab8f02:5280958c:b2 in state  RUN

在警告之后,我的索引因错误而中止:

    WARN 2013-11-11 09:36:36,460 [arjuna] ARJUNA012117: TransactionReaper::check timeout for TX 0:ffff91e40e22:-2eab8f02:5280958c:e2 in state  RUN
 WARN 2013-11-11 09:36:36,465 [SqlExceptionHelper] SQL Error: 0, SQLState: null
ERROR 2013-11-11 09:36:36,465 [SqlExceptionHelper] javax.resource.ResourceException: IJ000460: Error checking for a transaction
 WARN 2013-11-11 09:36:36,468 [arjuna] ARJUNA012121: TransactionReaper::doCancellations worker Thread[Transaction Reaper Worker 0,5,main] successfully canceled TX 0:ffff91e40e22:-2eab8f02:5280958c:cc
 WARN 2013-11-11 09:36:36,468 [arjuna] ARJUNA012095: Abort of action id 0:ffff91e40e22:-2eab8f02:5280958c:ce invoked while multiple threads active within it.
 WARN 2013-11-11 09:36:36,469 [arjuna] ARJUNA012108: CheckedAction::check - atomic action 0:ffff91e40e22:-2eab8f02:5280958c:ce aborting with 1 threads active!
ERROR 2013-11-11 09:36:36,467 [LogErrorHandler] HSEARCH000058: HSEARCH000116: Unexpected error during MassIndexer operation: org.hibernate.exception.GenericJDBCException: Could not open connection
    at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54)
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125)
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110)
    at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:304)
    at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:169)
    at org.hibernate.engine.jdbc.internal.proxy.ConnectionProxyHandler.extractPhysicalConnection(ConnectionProxyHandler.java:82)
    at org.hibernate.engine.jdbc.internal.proxy.ConnectionProxyHandler.continueInvocation(ConnectionProxyHandler.java:138)
    at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81)
    at com.sun.proxy.$Proxy168.prepareStatement(Unknown Source)
    at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:147)
    at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:166)
    at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareQueryStatement(StatementPreparerImpl.java:145)
    at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1720)
    at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1697)
    at org.hibernate.loader.Loader.doQuery(Loader.java:832)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:293)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:263)
    at org.hibernate.loader.Loader.loadEntity(Loader.java:1977)
    at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:82)
    at org.hibernate.loader.entity.EntityLoader.loadByUniqueKey(EntityLoader.java:161)    
....
....

ERROR 2013-11-11 09:36:36,475 [LogErrorHandler] HSEARCH000058: HSEARCH000116: Unexpected error during MassIndexer operation: javax.transaction.RollbackException: ARJUNA016063: The transaction is not active!
    at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1155)
    at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:117)
    at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
    at org.hibernate.search.batchindexing.impl.OptionallyWrapInJTATransaction.run(OptionallyWrapInJTATransaction.java:95)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:722)
4

0 回答 0