You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ma...@apache.org on 2018/01/10 05:32:38 UTC
atlas git commit: ATLAS-2169: delete request fails when hard-delete
is configured
Repository: atlas
Updated Branches:
refs/heads/branch-0.8 a087963d9 -> 5fa75627d
ATLAS-2169: delete request fails when hard-delete is configured
Change-Id: Ia7b7e5c825db6841cf4f005e59dc1dc07ef3cb3e
Project: http://git-wip-us.apache.org/repos/asf/atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/5fa75627
Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/5fa75627
Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/5fa75627
Branch: refs/heads/branch-0.8
Commit: 5fa75627dfb93a59880f94dd7579885a91c7088f
Parents: a087963
Author: Madhan Neethiraj <ma...@apache.org>
Authored: Tue Jan 9 16:58:33 2018 -0800
Committer: Madhan Neethiraj <ma...@apache.org>
Committed: Tue Jan 9 16:59:32 2018 -0800
----------------------------------------------------------------------
.../store/graph/v1/AtlasEntityChangeNotifier.java | 17 +++++++++++++----
.../persistence/ReferenceableInstance.java | 9 +++++++++
2 files changed, 22 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/atlas/blob/5fa75627/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java
index f04f9d0..ffcca05 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java
@@ -33,6 +33,7 @@ import org.apache.atlas.repository.graph.GraphHelper;
import org.apache.atlas.repository.graphdb.AtlasVertex;
import org.apache.atlas.typesystem.ITypedReferenceableInstance;
import org.apache.atlas.typesystem.ITypedStruct;
+import org.apache.atlas.typesystem.persistence.ReferenceableInstance;
import org.apache.atlas.util.AtlasRepositoryConfiguration;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@@ -155,7 +156,7 @@ public class AtlasEntityChangeNotifier {
return;
}
- List<ITypedReferenceableInstance> typedRefInsts = toITypedReferenceable(entityHeaders);
+ List<ITypedReferenceableInstance> typedRefInsts = toITypedReferenceable(entityHeaders, operation);
for (EntityChangeListener listener : entityChangeListeners) {
try {
@@ -177,11 +178,19 @@ public class AtlasEntityChangeNotifier {
}
}
- private List<ITypedReferenceableInstance> toITypedReferenceable(List<AtlasEntityHeader> entityHeaders) throws AtlasBaseException {
+ private List<ITypedReferenceableInstance> toITypedReferenceable(List<AtlasEntityHeader> entityHeaders, EntityOperation operation) throws AtlasBaseException {
List<ITypedReferenceableInstance> ret = new ArrayList<>(entityHeaders.size());
- for (AtlasEntityHeader entityHeader : entityHeaders) {
- ret.add(instanceConverter.getITypedReferenceable(entityHeader.getGuid()));
+ // delete notifications need only entity-guid. In case of hard-delete, getITypedReferenceable() call below will
+ // fail, since the entity vertex would already be gone. Hence the special handling for delete operation
+ if (operation == EntityOperation.DELETE) {
+ for (AtlasEntityHeader entity : entityHeaders) {
+ ret.add(new ReferenceableInstance(entity.getGuid(), entity.getTypeName()));
+ }
+ } else {
+ for (AtlasEntityHeader entityHeader : entityHeaders) {
+ ret.add(instanceConverter.getITypedReferenceable(entityHeader.getGuid()));
+ }
}
return ret;
http://git-wip-us.apache.org/repos/asf/atlas/blob/5fa75627/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/ReferenceableInstance.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/ReferenceableInstance.java b/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/ReferenceableInstance.java
index be2634d..18e9a94 100755
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/ReferenceableInstance.java
+++ b/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/ReferenceableInstance.java
@@ -26,6 +26,7 @@ import org.apache.atlas.typesystem.IReferenceableInstance;
import org.apache.atlas.typesystem.IStruct;
import org.apache.atlas.typesystem.ITypedReferenceableInstance;
import org.apache.atlas.typesystem.ITypedStruct;
+import org.apache.atlas.typesystem.types.AttributeInfo;
import org.apache.atlas.typesystem.types.ClassType;
import org.apache.atlas.typesystem.types.FieldMapping;
import org.apache.atlas.typesystem.types.TypeSystem;
@@ -47,6 +48,14 @@ public class ReferenceableInstance extends StructInstance implements ITypedRefer
private Id id;
private AtlasSystemAttributes systemAttributes;
+ private static final boolean[] EMPTY_BOOL_ARRAY = new boolean[0];
+ private static final ImmutableMap<String, ITypedStruct> EMPTY_TRAITS_MAP = ImmutableMap.of();
+ private static final FieldMapping EMPTY_FIELD_MAPPING = new FieldMapping(ImmutableMap.<String, AttributeInfo>of(), ImmutableMap.<String, Integer>of(), ImmutableMap.<String, Integer>of(), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+
+ public ReferenceableInstance(String guid, String typeName) {
+ this(new Id(guid, 0, typeName), typeName, null, EMPTY_FIELD_MAPPING, EMPTY_BOOL_ARRAY, EMPTY_BOOL_ARRAY,
+ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, EMPTY_TRAITS_MAP);
+ }
public ReferenceableInstance(Id id, String dataTypeName, AtlasSystemAttributes systemAttributes, FieldMapping fieldMapping, boolean[] nullFlags,
boolean[] explicitSets, boolean[] bools, byte[] bytes, short[] shorts, int[] ints, long[] longs, float[] floats, double[] doubles,