You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by ch...@apache.org on 2017/05/24 14:33:48 UTC

svn commit: r1796070 - /jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/index/OutOfBandIndexer.java

Author: chetanm
Date: Wed May 24 14:33:48 2017
New Revision: 1796070

URL: http://svn.apache.org/viewvc?rev=1796070&view=rev
Log:
OAK-6246 - Support for out of band indexing with read only access to NodeStore

Configure node count estimator

Modified:
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/index/OutOfBandIndexer.java

Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/index/OutOfBandIndexer.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/index/OutOfBandIndexer.java?rev=1796070&r1=1796069&r2=1796070&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/index/OutOfBandIndexer.java (original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/index/OutOfBandIndexer.java Wed May 24 14:33:48 2017
@@ -41,9 +41,11 @@ import org.apache.jackrabbit.oak.plugins
 import org.apache.jackrabbit.oak.plugins.index.IndexUpdate;
 import org.apache.jackrabbit.oak.plugins.index.IndexUpdateCallback;
 import org.apache.jackrabbit.oak.plugins.index.NodeTraversalCallback;
+import org.apache.jackrabbit.oak.plugins.index.counter.jmx.NodeCounter;
 import org.apache.jackrabbit.oak.plugins.index.lucene.directory.DirectoryFactory;
 import org.apache.jackrabbit.oak.plugins.index.lucene.directory.FSDirectoryFactory;
 import org.apache.jackrabbit.oak.plugins.index.progress.MetricRateEstimator;
+import org.apache.jackrabbit.oak.plugins.index.progress.NodeCounterMBeanEstimator;
 import org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider;
 import org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore;
 import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
@@ -171,7 +173,7 @@ public class OutOfBandIndexer implements
                 CorruptIndexHandler.NOOP
         );
 
-        configureEstimator(indexUpdate);
+        configureEstimators(indexUpdate);
 
         //Do not use EmptyState as before otherwise the IndexUpdate would
         //unnecessary traverse the whole repo post reindexing. With use of baseState
@@ -265,11 +267,15 @@ public class OutOfBandIndexer implements
         FileUtils.moveDirectoryToDirectory(getLocalIndexDir(), indexHelper.getOutputDir(), true);
     }
 
-    private void configureEstimator(IndexUpdate indexUpdate) {
+    private void configureEstimators(IndexUpdate indexUpdate) {
         StatisticsProvider statsProvider = indexHelper.getStatisticsProvider();
         if (statsProvider instanceof MetricStatisticsProvider) {
             MetricRegistry registry = ((MetricStatisticsProvider) statsProvider).getRegistry();
             indexUpdate.setTraversalRateEstimator(new MetricRateEstimator(REINDEX_LANE, registry));
         }
+
+        NodeCounter nodeCounter = new NodeCounter(indexHelper.getNodeStore());
+        NodeCounterMBeanEstimator estimator = new NodeCounterMBeanEstimator(nodeCounter);
+        indexUpdate.setNodeCountEstimator(estimator);
     }
 }