Skip to content
Snippets Groups Projects
Commit b2d70d64 authored by tpylak's avatar tpylak
Browse files

LMS-659 bigger timeout during legacy db indexing

SVN: 9106
parent 3cd9eca6
No related branches found
No related tags found
No related merge requests found
...@@ -22,6 +22,7 @@ import java.util.Set; ...@@ -22,6 +22,7 @@ import java.util.Set;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.time.StopWatch; import org.apache.commons.lang.time.StopWatch;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.apache.lucene.index.IndexWriter;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.SessionFactory; import org.hibernate.SessionFactory;
import org.hibernate.search.annotations.Indexed; import org.hibernate.search.annotations.Indexed;
...@@ -60,6 +61,8 @@ public final class FullTextIndexerRunnable extends HibernateDaoSupport implement ...@@ -60,6 +61,8 @@ public final class FullTextIndexerRunnable extends HibernateDaoSupport implement
this.context = context; this.context = context;
operationLog.debug(String.format("Hibernate search context: %s.", context)); operationLog.debug(String.format("Hibernate search context: %s.", context));
fullTextIndexer = new DefaultFullTextIndexer(context.getBatchSize()); fullTextIndexer = new DefaultFullTextIndexer(context.getBatchSize());
// TODO 2008-11-25, Tomasz Pylak: maybe we could get rid of hardcoding package path by
// scanning Hibernate mapped entities?
indexedEntityFinder = indexedEntityFinder =
new PackageBasedIndexedEntityFinder("ch.systemsx.cisd.openbis.generic.shared.dto"); new PackageBasedIndexedEntityFinder("ch.systemsx.cisd.openbis.generic.shared.dto");
} }
...@@ -85,6 +88,8 @@ public final class FullTextIndexerRunnable extends HibernateDaoSupport implement ...@@ -85,6 +88,8 @@ public final class FullTextIndexerRunnable extends HibernateDaoSupport implement
Class<?> currentEntity = null; Class<?> currentEntity = null;
try try
{ {
// timeout exceptions were observed for the default timeout when database was bigger
IndexWriter.setDefaultWriteLockTimeout(3000);
final File indexBase = new File(context.getIndexBase()); final File indexBase = new File(context.getIndexBase());
final File markerFile = new File(indexBase, FULL_TEXT_INDEX_MARKER_FILENAME); final File markerFile = new File(indexBase, FULL_TEXT_INDEX_MARKER_FILENAME);
if (indexMode == IndexMode.SKIP_IF_MARKER_FOUND && markerFile.exists()) if (indexMode == IndexMode.SKIP_IF_MARKER_FOUND && markerFile.exists())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment