use of org.alfresco.solr.tracker.MetadataTracker in project SearchServices by Alfresco.
the class ConsistencyComponent method process.
@Override
public void process(ResponseBuilder rb) throws IOException {
SolrQueryRequest req = rb.req;
AlfrescoCoreAdminHandler adminHandler = (AlfrescoCoreAdminHandler) req.getCore().getCoreContainer().getMultiCoreHandler();
boolean isShard = rb.req.getParams().getBool(ShardParams.IS_SHARD, false);
MetadataTracker metaTrkr = adminHandler.getTrackerRegistry().getTrackerForCore(req.getCore().getName(), MetadataTracker.class);
if (metaTrkr != null && !isShard) {
TrackerState metadataTrkrState = metaTrkr.getTrackerState();
long lastIndexedTx = metadataTrkrState.getLastIndexedTxId();
long lastIndexTxCommitTime = metadataTrkrState.getLastIndexedTxCommitTime();
long lastTxIdOnServer = metadataTrkrState.getLastTxIdOnServer();
long transactionsToDo = lastTxIdOnServer - lastIndexedTx;
if (transactionsToDo < 0) {
transactionsToDo = 0;
}
rb.rsp.add("lastIndexedTx", lastIndexedTx);
rb.rsp.add("lastIndexedTxTime", lastIndexTxCommitTime);
rb.rsp.add("txRemaining", transactionsToDo);
}
}
use of org.alfresco.solr.tracker.MetadataTracker in project SearchServices by Alfresco.
the class SolrCoreLoadRegistration method createTrackers.
/**
* Creates the trackers
*
* @param coreName
* @param trackerRegistry
* @param props
* @param scheduler
* @param repositoryClient
* @param srv
* @return A list of trackers
*/
private static List<Tracker> createTrackers(String coreName, TrackerRegistry trackerRegistry, Properties props, SolrTrackerScheduler scheduler, SOLRAPIClient repositoryClient, SolrInformationServer srv) {
List<Tracker> trackers = new ArrayList<Tracker>();
AclTracker aclTracker = new AclTracker(props, repositoryClient, coreName, srv);
trackerRegistry.register(coreName, aclTracker);
scheduler.schedule(aclTracker, coreName, props);
ContentTracker contentTrkr = new ContentTracker(props, repositoryClient, coreName, srv);
trackerRegistry.register(coreName, contentTrkr);
scheduler.schedule(contentTrkr, coreName, props);
MetadataTracker metaTrkr = new MetadataTracker(props, repositoryClient, coreName, srv);
trackerRegistry.register(coreName, metaTrkr);
scheduler.schedule(metaTrkr, coreName, props);
CascadeTracker cascadeTrkr = new CascadeTracker(props, repositoryClient, coreName, srv);
trackerRegistry.register(coreName, cascadeTrkr);
scheduler.schedule(cascadeTrkr, coreName, props);
// The CommitTracker will acquire these locks in order
// The ContentTracker will likely have the longest runs so put it first to ensure the MetadataTracker is not paused while
// waiting for the ContentTracker to release it's lock.
// The aclTracker will likely have the shortest runs so put it last.
trackers.add(cascadeTrkr);
trackers.add(contentTrkr);
trackers.add(metaTrkr);
trackers.add(aclTracker);
return trackers;
}
Aggregations