SEARCH-243: CommitTracker is taking a long time to acquire locks

This commit is contained in:
Joel
2016-11-20 22:38:56 -05:00
parent e88e5be097
commit 8036a2a712
4 changed files with 21 additions and 3 deletions
@@ -102,8 +102,9 @@ public class SolrCoreLoadRegistration {
}
List<Tracker> trackers = createTrackers(coreName, trackerRegistry, props, scheduler, repositoryClient, srv);
List<Tracker> lockBeforeCommit = getLockBeforeCommit(trackers);
CommitTracker commitTracker = new CommitTracker(props, repositoryClient, coreName, srv, trackers);
CommitTracker commitTracker = new CommitTracker(props, repositoryClient, coreName, srv, lockBeforeCommit);
trackerRegistry.register(coreName, commitTracker);
scheduler.schedule(commitTracker, coreName, props);
log.info("The Trackers are now scheduled to run");
@@ -164,6 +165,18 @@ public class SolrCoreLoadRegistration {
return trackers;
}
private static List<Tracker> getLockBeforeCommit(List<Tracker> trackers) {
List<Tracker> lockBeforeCommit = new ArrayList();
for(Tracker tracker : trackers) {
if(tracker instanceof MetadataTracker) {
lockBeforeCommit.add(tracker);
}else if(tracker instanceof AclTracker) {
lockBeforeCommit.add(tracker);
}
}
return lockBeforeCommit;
}
/**
* Shuts down the trackers for a core.
*
@@ -49,7 +49,7 @@ public class ContentTracker extends AbstractTracker implements Tracker
InformationServer informationServer)
{
super(p, client, coreName, informationServer);
contentReadBatchSize = Integer.parseInt(p.getProperty("alfresco.contentReadBatchSize", "1000"));
contentReadBatchSize = Integer.parseInt(p.getProperty("alfresco.contentReadBatchSize", "100"));
contentUpdateBatchSize = Integer.parseInt(p.getProperty("alfresco.contentUpdateBatchSize", "1000"));
threadHandler = new ThreadHandler(p, coreName, "ContentTracker");
}
@@ -658,6 +658,11 @@ public class MetadataTracker extends AbstractTracker implements Tracker
trackerStats.addElapsedNodeTime(docCount, endElapsed - startElapsed);
startElapsed = endElapsed;
docCount = 0;
//Release the write lock allowing the commit tracker to run.
this.getWriteLock().release();
//Re-acquire the write lock and keep indexing.
this.getWriteLock().acquire();
}
checkShutdown();
}
@@ -103,7 +103,7 @@ alfresco.transactionDocsBatchSize=500
alfresco.nodeBatchSize=100
alfresco.changeSetAclsBatchSize=500
alfresco.aclBatchSize=100
alfresco.contentReadBatchSize=1000
alfresco.contentReadBatchSize=100
alfresco.contentUpdateBatchSize=1000
# Warming