Search in sources :

Example 1 with MetadataTracker

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);
    }
}
Also used : SolrQueryRequest(org.apache.solr.request.SolrQueryRequest) AlfrescoCoreAdminHandler(org.alfresco.solr.AlfrescoCoreAdminHandler) TrackerState(org.alfresco.solr.TrackerState) MetadataTracker(org.alfresco.solr.tracker.MetadataTracker)

Example 2 with MetadataTracker

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;
}
Also used : ContentTracker(org.alfresco.solr.tracker.ContentTracker) Tracker(org.alfresco.solr.tracker.Tracker) MetadataTracker(org.alfresco.solr.tracker.MetadataTracker) CommitTracker(org.alfresco.solr.tracker.CommitTracker) CascadeTracker(org.alfresco.solr.tracker.CascadeTracker) AclTracker(org.alfresco.solr.tracker.AclTracker) ModelTracker(org.alfresco.solr.tracker.ModelTracker) ArrayList(java.util.ArrayList) AclTracker(org.alfresco.solr.tracker.AclTracker) ContentTracker(org.alfresco.solr.tracker.ContentTracker) CascadeTracker(org.alfresco.solr.tracker.CascadeTracker) MetadataTracker(org.alfresco.solr.tracker.MetadataTracker)

Aggregations

MetadataTracker (org.alfresco.solr.tracker.MetadataTracker)2 ArrayList (java.util.ArrayList)1 AlfrescoCoreAdminHandler (org.alfresco.solr.AlfrescoCoreAdminHandler)1 TrackerState (org.alfresco.solr.TrackerState)1 AclTracker (org.alfresco.solr.tracker.AclTracker)1 CascadeTracker (org.alfresco.solr.tracker.CascadeTracker)1 CommitTracker (org.alfresco.solr.tracker.CommitTracker)1 ContentTracker (org.alfresco.solr.tracker.ContentTracker)1 ModelTracker (org.alfresco.solr.tracker.ModelTracker)1 Tracker (org.alfresco.solr.tracker.Tracker)1 SolrQueryRequest (org.apache.solr.request.SolrQueryRequest)1