Class MetadataTracker

    • Field Detail

      • LOGGER

        protected static final org.slf4j.Logger LOGGER
    • Constructor Detail

      • MetadataTracker

        public MetadataTracker​(java.util.Properties p,
                               org.alfresco.solr.client.SOLRAPIClient client,
                               java.lang.String coreName,
                               InformationServer informationServer)
      • MetadataTracker

        public MetadataTracker​(java.util.Properties p,
                               org.alfresco.solr.client.SOLRAPIClient client,
                               java.lang.String coreName,
                               InformationServer informationServer,
                               boolean checkRepoServicesAvailability)
        MetadataTracker constructor
        Parameters:
        p - includes SOLR core properties (from environment variables and properties file)
        client - Alfresco Repository http client
        coreName - Name of the SOLR Core (alfresco, archive)
        informationServer - SOLR Information Server
        checkRepoServicesAvailability - is true if Repo Services availability needs to be checked
    • Method Detail

      • getWriteLock

        public java.util.concurrent.Semaphore getWriteLock()
        Description copied from class: AbstractTracker
        Trackers implementing this method should decide if the Write Lock is applied globally for every Tracker Thread (static) or locally for each running Thread
        Specified by:
        getWriteLock in interface Tracker
        Specified by:
        getWriteLock in class AbstractTracker
      • getRunLock

        public java.util.concurrent.Semaphore getRunLock()
        Description copied from class: AbstractTracker
        Trackers implementing this method should decide if the Run Lock is applied globally for every Tracker Thread (static) or locally for each running Thread
        Specified by:
        getRunLock in class AbstractTracker
      • doTrack

        protected void doTrack​(java.lang.String iterationId)
                        throws org.alfresco.httpclient.AuthenticationException,
                               java.io.IOException,
                               org.json.JSONException
        Description copied from class: AbstractTracker
        Subclasses must implement behaviour that completes the following steps, in order:
        1. Purge
        2. Reindex
        3. Index
        4. Track repository
        Specified by:
        doTrack in class AbstractTracker
        Parameters:
        iterationId - an identifier which is uniquely associated with a given iteration.
        Throws:
        org.alfresco.httpclient.AuthenticationException
        java.io.IOException
        org.json.JSONException
      • maintenance

        public void maintenance()
                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • hasMaintenance

        public boolean hasMaintenance()
      • getTxFromCommitTime

        protected java.lang.Long getTxFromCommitTime​(org.alfresco.solr.BoundedDeque<org.alfresco.solr.client.Transaction> txnsFound,
                                                     long lastGoodTxCommitTimeInIndex)
        The fromCommitTime tells getSomeTransactions() where to start, this actually fairly straight forward. What makes this code so tricky to understand is the state.getTimeToStopIndexing(). There are two scenarios to keep in mind: 1) Full re-index: In this scenario the state.getTimeToStopIndexing() will never stop the indexing. 2) Up-to-date indexing: This is where state.getTimeToStopIndexing() gets interesting. In this scenario the Solr index is already up to date with the repo and it is tracking new transactions. The state.getTimeToStopIndexing() in this scenario causes the getSomeTransactions() call to stop returning results if it finds a transaction beyond a specific point in time. This will break out of this loop and end the tracker run. The next time the metadata tracker runs the "continueState()" method applies the "hole retention" to state.getLastGoodTxCommitTimeInIndex(). This causes the state.getLastGoodTxCommitTimeInIndex() to scan for prior transactions that might have been missed.
      • getSomeTransactions

        protected org.alfresco.solr.client.Transactions getSomeTransactions​(org.alfresco.solr.BoundedDeque<org.alfresco.solr.client.Transaction> txnsFound,
                                                                            java.lang.Long fromCommitTime,
                                                                            long timeStep,
                                                                            int maxResults,
                                                                            long endTime)
                                                                     throws org.alfresco.httpclient.AuthenticationException,
                                                                            java.io.IOException,
                                                                            org.json.JSONException,
                                                                            org.apache.commons.codec.EncoderException,
                                                                            java.lang.NoSuchMethodException
        Throws:
        org.alfresco.httpclient.AuthenticationException
        java.io.IOException
        org.json.JSONException
        org.apache.commons.codec.EncoderException
        java.lang.NoSuchMethodException
      • trackTransactions

        protected void trackTransactions()
                                  throws java.io.IOException,
                                         org.json.JSONException
        Indexing new transactions from repository in batches of "transactionDocsBatchSize" size. Additionally, the nodes inside a transaction batch are indexed in batches of "nodeBatchSize" size.
        Throws:
        java.io.IOException
        org.json.JSONException
      • checkNode

        public org.alfresco.solr.NodeReport checkNode​(java.lang.Long dbid)
        Description copied from class: AbstractTracker
        Returns information about the Node associated with the given dbid.
        Overrides:
        checkNode in class AbstractTracker
        Parameters:
        dbid - the node identifier.
        Returns:
        the Node associated with the given dbid.
      • checkNode

        public org.alfresco.solr.NodeReport checkNode​(org.alfresco.solr.client.Node node)
      • getFullNodesForDbTransaction

        public java.util.List<org.alfresco.solr.client.Node> getFullNodesForDbTransaction​(java.lang.Long txid)
      • checkIndex

        public org.alfresco.solr.tracker.IndexHealthReport checkIndex​(java.lang.Long toTx,
                                                                      java.lang.Long fromTime,
                                                                      java.lang.Long toTime)
                                                               throws java.io.IOException,
                                                                      org.alfresco.httpclient.AuthenticationException,
                                                                      org.json.JSONException,
                                                                      org.apache.commons.codec.EncoderException,
                                                                      java.lang.NoSuchMethodException
        Throws:
        java.io.IOException
        org.alfresco.httpclient.AuthenticationException
        org.json.JSONException
        org.apache.commons.codec.EncoderException
        java.lang.NoSuchMethodException
      • addTransactionToPurge

        public void addTransactionToPurge​(java.lang.Long txId)
      • addNodeToPurge

        public void addNodeToPurge​(java.lang.Long nodeId)
      • addTransactionToReindex

        public void addTransactionToReindex​(java.lang.Long txId)
      • addNodeToReindex

        public void addNodeToReindex​(java.lang.Long nodeId)
      • addTransactionToIndex

        public void addTransactionToIndex​(java.lang.Long txId)
      • addNodeToIndex

        public void addNodeToIndex​(java.lang.Long nodeId)
      • addQueryToReindex

        public void addQueryToReindex​(java.lang.String query)