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 04:55:46 UTC

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

Author: chetanm
Date: Wed May 24 04:55:46 2017
New Revision: 1795999

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

Perform IndexUpdate from last base state instead of EmptyState otherwise
the IndexUpdate was traversing whole repo to see if any index definition
are found for current lane.

With this it only traverses those paths where index definition has been
modified for reindexing

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=1795999&r1=1795998&r2=1795999&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 04:55:46 2017
@@ -115,12 +115,13 @@ public class OutOfBandIndexer implements
         NodeState checkpointedState = retrieveNodeStateForCheckpoint();
 
         copyOnWriteStore = new MemoryNodeStore(checkpointedState);
+        NodeState baseState = copyOnWriteStore.getRoot();
         //TODO Check for indexPaths being empty
 
         log.info("Proceeding to index {} upto checkpoint {} {}", indexHelper.getIndexPaths(), checkpoint, checkpointInfo);
 
         switchIndexLanesAndReindexFlag();
-        preformIndexUpdate();
+        preformIndexUpdate(baseState);
         writeMetaInfo();
         copyIndexFilesToOutput();
 
@@ -153,7 +154,7 @@ public class OutOfBandIndexer implements
 
     }
 
-    private void preformIndexUpdate() throws IOException, CommitFailedException {
+    private void preformIndexUpdate(NodeState baseState) throws IOException, CommitFailedException {
         NodeBuilder builder = copyOnWriteStore.getRoot().builder();
 
         IndexUpdate indexUpdate = new IndexUpdate(
@@ -167,7 +168,11 @@ public class OutOfBandIndexer implements
                 CorruptIndexHandler.NOOP
         );
 
-        NodeState before = EmptyNodeState.EMPTY_NODE;
+        //Do not use EmptyState as before otherwise the IndexUpdate would
+        //unnecessary traverse the whole repo post reindexing. With use of baseState
+        //It would only traverse the diff i.e. those index definitions paths
+        //whose lane has been changed
+        NodeState before = baseState;
         NodeState after = copyOnWriteStore.getRoot();
 
         CommitFailedException exception =