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/12/15 11:18:29 UTC
svn commit: r1818267 - in /jackrabbit/oak/trunk:
oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/progress/IndexingProgressReporter.java
oak-run/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/DocumentStoreIndexer.java
Author: chetanm
Date: Fri Dec 15 11:18:29 2017
New Revision: 1818267
URL: http://svn.apache.org/viewvc?rev=1818267&view=rev
Log:
OAK-6353 - Use Document order traversal for reindexing performed on DocumentNodeStore setups
Reuse the progress reporter
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/progress/IndexingProgressReporter.java
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/DocumentStoreIndexer.java
Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/progress/IndexingProgressReporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/progress/IndexingProgressReporter.java?rev=1818267&r1=1818266&r2=1818267&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/progress/IndexingProgressReporter.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/progress/IndexingProgressReporter.java Fri Dec 15 11:18:29 2017
@@ -43,7 +43,7 @@ public class IndexingProgressReporter im
private static final String INDEX_MSG = "Incremental indexing";
private final Logger log = LoggerFactory.getLogger(IndexUpdate.class);
- private final Stopwatch watch = Stopwatch.createStarted();
+ private Stopwatch watch = Stopwatch.createStarted();
private final IndexUpdateCallback updateCallback;
private final NodeTraversalCallback traversalCallback;
private final Map<String, IndexUpdateState> indexUpdateStates = new HashMap<>();
@@ -172,6 +172,12 @@ public class IndexingProgressReporter im
this.nodeCountEstimator = nodeCountEstimator;
}
+ public void reset(){
+ watch = Stopwatch.createStarted();
+ traversalCount = 0;
+ messagePrefix = INDEX_MSG;
+ }
+
private String estimatePendingTraversal(double nodesPerSecond) {
if (estimatedCount >= 0) {
if (estimatedCount > traversalCount){
Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/DocumentStoreIndexer.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/DocumentStoreIndexer.java?rev=1818267&r1=1818266&r2=1818267&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/DocumentStoreIndexer.java (original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/DocumentStoreIndexer.java Fri Dec 15 11:18:29 2017
@@ -64,7 +64,7 @@ public class DocumentStoreIndexer implem
private final IndexHelper indexHelper;
private final List<NodeStateIndexerProvider> indexerProviders;
private final IndexerSupport indexerSupport;
- private IndexingProgressReporter progressReporter =
+ private final IndexingProgressReporter progressReporter =
new IndexingProgressReporter(IndexUpdateCallback.NOOP, NodeTraversalCallback.NOOP);
private final Set<String> indexerPaths = new HashSet<>();
@@ -110,7 +110,10 @@ public class DocumentStoreIndexer implem
.build();
closer.register(flatFileStore);
- reconfigureReporter(flatFileStore);
+ progressReporter.reset();
+ if (flatFileStore.getEntryCount() > 0){
+ progressReporter.setNodeCountEstimator((String basePath, Set<String> indexPaths) -> flatFileStore.getEntryCount());
+ }
progressReporter.reindexingTraversalStart("/");
@@ -132,37 +135,16 @@ public class DocumentStoreIndexer implem
}
private void configureEstimators() {
- configureTraversalRateEstimator(progressReporter);
- long nodesCount = getEstimatedDocumentCount();
- if (nodesCount > 0) {
- progressReporter.setNodeCountEstimator((String basePath, Set<String> indexPaths) -> nodesCount);
- log.info("Estimated number of documents in Mongo are {}", nodesCount);
- }
- }
-
- private void reconfigureReporter(FlatFileStore flatFileStore) {
- progressReporter =
- new IndexingProgressReporter(IndexUpdateCallback.NOOP, NodeTraversalCallback.NOOP);
- configureTraversalRateEstimator(progressReporter);
- long entryCount = flatFileStore.getEntryCount();
- if (entryCount > 0) {
- progressReporter.setNodeCountEstimator((String basePath, Set<String> indexPaths) -> entryCount);
- log.info("Estimated number of entries in flat file store are {}", entryCount);
- } else {
- log.info("Number of entries in flat file store are unknown");
- }
-
- for (String indexerPath : indexerPaths){
- progressReporter.registerIndex(indexerPath, true, -1);
- }
- }
-
- private void configureTraversalRateEstimator(IndexingProgressReporter progressReporter) {
StatisticsProvider statsProvider = indexHelper.getStatisticsProvider();
if (statsProvider instanceof MetricStatisticsProvider) {
MetricRegistry registry = ((MetricStatisticsProvider) statsProvider).getRegistry();
progressReporter.setTraversalRateEstimator(new MetricRateEstimator("async", registry));
}
+ long nodesCount = getEstimatedDocumentCount();
+ if (nodesCount > 0) {
+ progressReporter.setNodeCountEstimator((String basePath, Set<String> indexPaths) -> nodesCount);
+ log.info("Estimated number of documents in Mongo are {}", nodesCount);
+ }
}
private long getEstimatedDocumentCount(){