You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by am...@apache.org on 2020/12/16 19:26:04 UTC

[atlas] branch branch-2.0 updated: ATLAS-4015: Add Re-indexing as JAVA_PATCH. Part 2

This is an automated email from the ASF dual-hosted git repository.

amestry pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new e8dcde5  ATLAS-4015: Add Re-indexing as JAVA_PATCH. Part 2
e8dcde5 is described below

commit e8dcde528deb0e9d5a9edbc28cb3ccb6f87cba0f
Author: Ashutosh Mestry <am...@cloudera.com>
AuthorDate: Fri Nov 13 10:15:23 2020 -0800

    ATLAS-4015: Add Re-indexing as JAVA_PATCH. Part 2
---
 .../src/main/java/org/apache/atlas/AtlasConfiguration.java |  2 +-
 .../org/apache/atlas/repository/patches/ReIndexPatch.java  | 14 ++++++++------
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/intg/src/main/java/org/apache/atlas/AtlasConfiguration.java b/intg/src/main/java/org/apache/atlas/AtlasConfiguration.java
index 2d3dfdf..ea9f26d 100644
--- a/intg/src/main/java/org/apache/atlas/AtlasConfiguration.java
+++ b/intg/src/main/java/org/apache/atlas/AtlasConfiguration.java
@@ -74,7 +74,7 @@ public enum AtlasConfiguration {
 
     HTTP_HEADER_SERVER_VALUE("atlas.http.header.server.value","Apache Atlas"),
     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;
 
diff --git a/repository/src/main/java/org/apache/atlas/repository/patches/ReIndexPatch.java b/repository/src/main/java/org/apache/atlas/repository/patches/ReIndexPatch.java
index a47a2cc..38d230f 100644
--- a/repository/src/main/java/org/apache/atlas/repository/patches/ReIndexPatch.java
+++ b/repository/src/main/java/org/apache/atlas/repository/patches/ReIndexPatch.java
@@ -23,6 +23,7 @@ import org.apache.atlas.pc.WorkItemBuilder;
 import org.apache.atlas.pc.WorkItemConsumer;
 import org.apache.atlas.pc.WorkItemManager;
 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.AtlasGraph;
 import org.apache.atlas.repository.graphdb.AtlasVertex;
@@ -53,7 +54,8 @@ public class ReIndexPatch extends AtlasPatchHandler {
 
     @Override
     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;
         }
 
@@ -113,8 +115,8 @@ public class ReIndexPatch extends AtlasPatchHandler {
         }
 
         private static void edges(WorkItemManager manager, AtlasGraph graph) {
-            Iterable<Object> iterable = graph.getEdges();
-            for (Iterator<Object> iter = iterable.iterator(); iter.hasNext(); ) {
+            Iterable<AtlasEdge> iterable = graph.getEdges();
+            for (Iterator<AtlasEdge> iter = iterable.iterator(); iter.hasNext(); ) {
                 manager.checkProduce(iter.next());
             }
         }
@@ -144,9 +146,9 @@ public class ReIndexPatch extends AtlasPatchHandler {
     }
 
     private static class ReindexConsumer extends WorkItemConsumer<AtlasElement> {
-        private List<AtlasElement> list = new ArrayList();
-        private AtlasGraph graph;
-        private String[] indexNames;
+        private final List<AtlasElement> list = new ArrayList();
+        private final String[] indexNames;
+        private final AtlasGraph graph;
         private final AtomicLong counter;
 
         public ReindexConsumer(BlockingQueue queue, AtlasGraph graph, String[] indexNames) {