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/07/17 05:31:01 UTC
svn commit: r1802094 -
/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/index/OutOfBandIndexer.java
Author: chetanm
Date: Mon Jul 17 05:31:01 2017
New Revision: 1802094
URL: http://svn.apache.org/viewvc?rev=1802094&view=rev
Log:
OAK-6271 - Support for importing index files
Use the AsyncLaneSwitcher instead of managing the logic of switch
locally
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=1802094&r1=1802093&r2=1802094&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 Mon Jul 17 05:31:01 2017
@@ -41,6 +41,7 @@ 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.importer.AsyncLaneSwitcher;
import org.apache.jackrabbit.oak.plugins.index.importer.IndexerInfo;
import org.apache.jackrabbit.oak.plugins.index.lucene.directory.DirectoryFactory;
import org.apache.jackrabbit.oak.plugins.index.lucene.directory.FSDirectoryFactory;
@@ -205,7 +206,7 @@ public class OutOfBandIndexer implements
//TODO Do it only for lucene indexes for now
NodeBuilder idxBuilder = NodeStoreUtils.childBuilder(builder, indexPath);
idxBuilder.setProperty(IndexConstants.REINDEX_PROPERTY_NAME, true);
- switchLane(idxBuilder);
+ AsyncLaneSwitcher.switchLane(idxBuilder, REINDEX_LANE);
}
copyOnWriteStore.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
@@ -225,29 +226,6 @@ public class OutOfBandIndexer implements
return checkpointedState;
}
- /**
- * Make a copy of current async value and replace it with one required for offline reindexing
- */
- static void switchLane(NodeBuilder idxBuilder) {
- PropertyState currentAsyncState = idxBuilder.getProperty(ASYNC_PROPERTY_NAME);
- PropertyState newAsyncState = PropertyStates.createProperty(ASYNC_PROPERTY_NAME, REINDEX_LANE, Type.STRING);
-
- PropertyState previousAsyncState;
- if (currentAsyncState == null) {
- previousAsyncState = PropertyStates.createProperty(ASYNC_PREVIOUS, ASYNC_PREVIOUS_NONE);
- } else {
- //Ensure that previous state is copied with correct type
- if (currentAsyncState.isArray()) {
- previousAsyncState = PropertyStates.createProperty(ASYNC_PREVIOUS, currentAsyncState.getValue(Type.STRINGS), Type.STRINGS);
- } else {
- previousAsyncState = PropertyStates.createProperty(ASYNC_PREVIOUS, currentAsyncState.getValue(Type.STRING), Type.STRING);
- }
- }
-
- idxBuilder.setProperty(previousAsyncState);
- idxBuilder.setProperty(newAsyncState);
- }
-
private void writeMetaInfo() throws IOException {
new IndexerInfo(getLocalIndexDir(), checkpoint).save();
}