Commit bf2e6091 by Ayub Khan Committed by Suma Shivaprasad

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

parent a07f3cc0
......@@ -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)
......
......@@ -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;
}
}
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