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/23 09:39:24 UTC
svn commit: r1795884 -
/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/index/OutOfBandIndexer.java
Author: chetanm
Date: Tue May 23 09:39:23 2017
New Revision: 1795884
URL: http://svn.apache.org/viewvc?rev=1795884&view=rev
Log:
OAK-6246 - Support for out of band indexing with read only access to NodeStore
Special handling for 'head' checkpoint as this causes issue when passed as
is to DocumentNodeStore
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=1795884&r1=1795883&r2=1795884&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 Tue May 23 09:39:23 2017
@@ -111,16 +111,10 @@ public class OutOfBandIndexer implements
public void reindex() throws CommitFailedException, IOException {
Stopwatch w = Stopwatch.createStarted();
- NodeState checkpointedState = indexHelper.getNodeStore().retrieve(checkpoint);
- if (checkpointedState == null && HEAD_AS_CHECKPOINT.equals(checkpoint)) {
- checkpointedState = indexHelper.getNodeStore().getRoot();
- log.warn("Using head state for indexing. Such an index cannot be imported back");
- }
+ NodeState checkpointedState = retrieveNodeStateForCheckpoint();
- checkNotNull(checkpointedState, "Not able to retrieve revision referred via checkpoint [%s]", checkpoint);
copyOnWriteStore = new MemoryNodeStore(checkpointedState);
- checkpointInfo = indexHelper.getNodeStore().checkpointInfo(checkpoint);
//TODO Check for indexPaths being empty
log.info("Proceeding to index {} upto checkpoint {} {}", indexHelper.getIndexPaths(), checkpoint, checkpointInfo);
@@ -213,6 +207,19 @@ public class OutOfBandIndexer implements
log.info("Switched the async lane for indexes at {} to {} and marked them for reindex", indexHelper.getIndexPaths(), REINDEX_LANE);
}
+ private NodeState retrieveNodeStateForCheckpoint() {
+ NodeState checkpointedState;
+ if (HEAD_AS_CHECKPOINT.equals(checkpoint)) {
+ checkpointedState = indexHelper.getNodeStore().getRoot();
+ log.warn("Using head state for indexing. Such an index cannot be imported back");
+ } else {
+ checkpointedState = indexHelper.getNodeStore().retrieve(checkpoint);
+ checkNotNull(checkpointedState, "Not able to retrieve revision referred via checkpoint [%s]", checkpoint);
+ checkpointInfo = indexHelper.getNodeStore().checkpointInfo(checkpoint);
+ }
+ return checkpointedState;
+ }
+
/**
* Make a copy of current async value and replace it with one required for offline reindexing
*/