You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by su...@apache.org on 2016/08/11 18:24:36 UTC

incubator-atlas git commit: ATLAS-1112: Hive hook notification contains multiple entities with same ID

Repository: incubator-atlas
Updated Branches:
  refs/heads/master a07f3cc04 -> bf2e60917


ATLAS-1112: Hive hook notification contains multiple entities with same ID


Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/bf2e6091
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/bf2e6091
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/bf2e6091

Branch: refs/heads/master
Commit: bf2e60917b7f202ccfa45accbdd836c7513427f2
Parents: a07f3cc
Author: Ayub Khan <ar...@gmail.com>
Authored: Thu Aug 11 11:00:02 2016 -0700
Committer: Suma Shivaprasad <su...@gmail.com>
Committed: Thu Aug 11 11:21:38 2016 -0700

----------------------------------------------------------------------
 release-log.txt                                     |  1 +
 .../org/apache/atlas/typesystem/persistence/Id.java | 16 +++++++++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/bf2e6091/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 2211a7c..1a54f2a 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -6,6 +6,7 @@ INCOMPATIBLE CHANGES:
 ATLAS-1060 Add composite indexes for exact match performance improvements for all attributes (sumasai via shwethags)
 
 ALL CHANGES:
+ATLAS-1112 Hive table GET response from atlas server had duplicate column entries ( ayubkhan, mneethiraj via sumasai)
 ATLAS-1108 In Atlas HA mode , import-hive.sh in Passive instance fails. (ayubkhan via sumasai)
 ATLAS-991 Lower bound checking not always disabled for entities being deleted (dkantor)
 ATLAS-1104 Get outgoing edges by label doesn't work in some cases (shwethags)

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/bf2e6091/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/Id.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/Id.java b/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/Id.java
index 04e220d..42280d0 100755
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/Id.java
+++ b/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/Id.java
@@ -33,6 +33,7 @@ import java.security.MessageDigest;
 import java.util.Date;
 import java.util.Map;
 import java.util.UUID;
+import java.util.concurrent.atomic.AtomicLong;
 
 public class Id implements ITypedReferenceableInstance {
     public enum EntityState {
@@ -43,6 +44,7 @@ public class Id implements ITypedReferenceableInstance {
     public final String typeName;
     public final int version;
     public EntityState state;
+    private static AtomicLong s_nextId = new AtomicLong(System.nanoTime());
 
     public Id(String id, int version, String typeName, String state) {
         id       = ParamChecker.notEmpty(id, "id");
@@ -71,7 +73,7 @@ public class Id implements ITypedReferenceableInstance {
     }
 
     public Id(String typeName) {
-        this("" + (-System.nanoTime()), 0, typeName);
+        this("" + Id.nextNegativeLong(), 0, typeName);
     }
 
     public boolean isUnassigned() {
@@ -294,4 +296,16 @@ public class Id implements ITypedReferenceableInstance {
         byte[] digest = digester.digest();
         return MD5Utils.toString(digest);
     }
+
+    private static long nextNegativeLong() {
+        long ret = s_nextId.getAndDecrement();
+
+        if (ret > 0) {
+          ret *= -1;
+        } else if (ret == 0) {
+          ret = Long.MIN_VALUE;
+        }
+
+        return ret;
+    }
 }