Commit a0a3c318 by Ashutosh Mestry

ATLAS-4015: Add Re-indexing as JAVA_PATCH. Part 2

parent 06106fe9
...@@ -74,7 +74,7 @@ public enum AtlasConfiguration { ...@@ -74,7 +74,7 @@ public enum AtlasConfiguration {
HTTP_HEADER_SERVER_VALUE("atlas.http.header.server.value","Apache Atlas"), HTTP_HEADER_SERVER_VALUE("atlas.http.header.server.value","Apache Atlas"),
STORAGE_CONSISTENCY_LOCK_ENABLED("atlas.graph.storage.consistency-lock.enabled", true), STORAGE_CONSISTENCY_LOCK_ENABLED("atlas.graph.storage.consistency-lock.enabled", true),
REINDEX_PATCH_ENABLED("atlas.patch.reindex.enabled", false); REBUILD_INDEX("atlas.rebuild.index", false);
private static final Configuration APPLICATION_PROPERTIES; private static final Configuration APPLICATION_PROPERTIES;
......
...@@ -23,6 +23,7 @@ import org.apache.atlas.pc.WorkItemBuilder; ...@@ -23,6 +23,7 @@ import org.apache.atlas.pc.WorkItemBuilder;
import org.apache.atlas.pc.WorkItemConsumer; import org.apache.atlas.pc.WorkItemConsumer;
import org.apache.atlas.pc.WorkItemManager; import org.apache.atlas.pc.WorkItemManager;
import org.apache.atlas.repository.Constants; import org.apache.atlas.repository.Constants;
import org.apache.atlas.repository.graphdb.AtlasEdge;
import org.apache.atlas.repository.graphdb.AtlasElement; import org.apache.atlas.repository.graphdb.AtlasElement;
import org.apache.atlas.repository.graphdb.AtlasGraph; import org.apache.atlas.repository.graphdb.AtlasGraph;
import org.apache.atlas.repository.graphdb.AtlasVertex; import org.apache.atlas.repository.graphdb.AtlasVertex;
...@@ -53,7 +54,8 @@ public class ReIndexPatch extends AtlasPatchHandler { ...@@ -53,7 +54,8 @@ public class ReIndexPatch extends AtlasPatchHandler {
@Override @Override
public void apply() throws AtlasBaseException { public void apply() throws AtlasBaseException {
if (AtlasConfiguration.REINDEX_PATCH_ENABLED.getBoolean() == false) { if (AtlasConfiguration.REBUILD_INDEX.getBoolean() == false) {
LOG.info("ReIndexPatch: Skipped, since not enabled!");
return; return;
} }
...@@ -113,8 +115,8 @@ public class ReIndexPatch extends AtlasPatchHandler { ...@@ -113,8 +115,8 @@ public class ReIndexPatch extends AtlasPatchHandler {
} }
private static void edges(WorkItemManager manager, AtlasGraph graph) { private static void edges(WorkItemManager manager, AtlasGraph graph) {
Iterable<Object> iterable = graph.getEdges(); Iterable<AtlasEdge> iterable = graph.getEdges();
for (Iterator<Object> iter = iterable.iterator(); iter.hasNext(); ) { for (Iterator<AtlasEdge> iter = iterable.iterator(); iter.hasNext(); ) {
manager.checkProduce(iter.next()); manager.checkProduce(iter.next());
} }
} }
...@@ -144,9 +146,9 @@ public class ReIndexPatch extends AtlasPatchHandler { ...@@ -144,9 +146,9 @@ public class ReIndexPatch extends AtlasPatchHandler {
} }
private static class ReindexConsumer extends WorkItemConsumer<AtlasElement> { private static class ReindexConsumer extends WorkItemConsumer<AtlasElement> {
private List<AtlasElement> list = new ArrayList(); private final List<AtlasElement> list = new ArrayList();
private AtlasGraph graph; private final String[] indexNames;
private String[] indexNames; private final AtlasGraph graph;
private final AtomicLong counter; private final AtomicLong counter;
public ReindexConsumer(BlockingQueue queue, AtlasGraph graph, String[] indexNames) { public ReindexConsumer(BlockingQueue queue, AtlasGraph graph, String[] indexNames) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment