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/07/01 22:30:11 UTC
atlas git commit: ATLAS-2770: entity-delete fails when Atlas is
configured for hard-delete
Repository: atlas
Updated Branches:
refs/heads/master 78cfd7184 -> eb22be8c3
ATLAS-2770: entity-delete fails when Atlas is configured for hard-delete
Project: http://git-wip-us.apache.org/repos/asf/atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/eb22be8c
Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/eb22be8c
Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/eb22be8c
Branch: refs/heads/master
Commit: eb22be8c36769d88c7ec342bf7f6195849dc13b2
Parents: 78cfd71
Author: Madhan Neethiraj <ma...@apache.org>
Authored: Sun Jul 1 09:49:22 2018 -0700
Committer: Madhan Neethiraj <ma...@apache.org>
Committed: Sun Jul 1 15:29:35 2018 -0700
----------------------------------------------------------------------
.../graph/v2/AtlasEntityChangeNotifier.java | 33 ++++++++++++++------
1 file changed, 24 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/atlas/blob/eb22be8c/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityChangeNotifier.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityChangeNotifier.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityChangeNotifier.java
index 7ed99a4..deb79e5 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityChangeNotifier.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityChangeNotifier.java
@@ -302,7 +302,7 @@ public class AtlasEntityChangeNotifier {
}
private void notifyV2Listeners(List<AtlasEntityHeader> entityHeaders, EntityOperation operation, boolean isImport) throws AtlasBaseException {
- List<AtlasEntity> entities = toAtlasEntities(entityHeaders);
+ List<AtlasEntity> entities = toAtlasEntities(entityHeaders, operation);
for (EntityChangeListenerV2 listener : entityChangeListenersV2) {
switch (operation) {
@@ -377,27 +377,42 @@ public class AtlasEntityChangeNotifier {
return ret;
}
- private List<AtlasEntity> toAtlasEntities(List<AtlasEntityHeader> entityHeaders) throws AtlasBaseException {
+ private List<AtlasEntity> toAtlasEntities(List<AtlasEntityHeader> entityHeaders, EntityOperation operation) throws AtlasBaseException {
List<AtlasEntity> ret = new ArrayList<>();
if (CollectionUtils.isNotEmpty(entityHeaders)) {
for (AtlasEntityHeader entityHeader : entityHeaders) {
- String entityGuid = entityHeader.getGuid();
- String typeName = entityHeader.getTypeName();
+ String entityGuid = entityHeader.getGuid();
+ String typeName = entityHeader.getTypeName();
+ AtlasEntityType entityType = atlasTypeRegistry.getEntityTypeByName(typeName);
+
+ if (entityType == null) {
+ continue;
+ }
// Skip all internal types as the HARD DELETE will cause lookup errors
- AtlasEntityType entityType = atlasTypeRegistry.getEntityTypeByName(typeName);
- if (Objects.nonNull(entityType) && entityType.isInternalType()) {
+ if (entityType.isInternalType()) {
if (LOG.isDebugEnabled()) {
LOG.debug("Skipping internal type = {}", typeName);
}
continue;
}
- AtlasEntityWithExtInfo entityWithExtInfo = instanceConverter.getAndCacheEntity(entityGuid);
+ final AtlasEntity entity;
+
+ // delete notifications don't need all attributes. Hence the special handling for delete operation
+ if (operation == EntityOperation.DELETE) {
+ entity = new AtlasEntity(typeName, entityHeader.getAttributes());
+
+ entity.setGuid(entityGuid);
+ } else {
+ AtlasEntityWithExtInfo entityWithExtInfo = instanceConverter.getAndCacheEntity(entityGuid);
+
+ entity = (entityWithExtInfo != null) ? entityWithExtInfo.getEntity() : null;
+ }
- if (entityWithExtInfo != null) {
- ret.add(entityWithExtInfo.getEntity());
+ if (entity != null) {
+ ret.add(entity);
}
}
}