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/06/04 06:30:16 UTC

[1/2] atlas git commit: ATLAS-2728: UI renders integer attribute values as date - kafka_topic.retentiontimeLocalInHrs, kafka_topic.retentiontimeNationalInHrs

Repository: atlas
Updated Branches:
  refs/heads/branch-1.0 0b3bc9898 -> c542deb6d


ATLAS-2728: UI renders integer attribute values as date - kafka_topic.retentiontimeLocalInHrs, kafka_topic.retentiontimeNationalInHrs

Signed-off-by: Madhan Neethiraj <ma...@apache.org>
(cherry picked from commit 52d5e474214041993db50818a8fb3609adf486fb)


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

Branch: refs/heads/branch-1.0
Commit: 80f0ef478e34516fa687d2359b86e928806d824f
Parents: 0b3bc98
Author: kevalbhatt <kb...@apache.org>
Authored: Thu May 31 22:52:51 2018 +0530
Committer: Madhan Neethiraj <ma...@apache.org>
Committed: Sun Jun 3 23:26:54 2018 -0700

----------------------------------------------------------------------
 dashboardv2/public/js/utils/CommonViewFunction.js | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/80f0ef47/dashboardv2/public/js/utils/CommonViewFunction.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/utils/CommonViewFunction.js b/dashboardv2/public/js/utils/CommonViewFunction.js
index af52ec4..b8e023a 100644
--- a/dashboardv2/public/js/utils/CommonViewFunction.js
+++ b/dashboardv2/public/js/utils/CommonViewFunction.js
@@ -202,7 +202,7 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
             var defEntity = _.find(attributeDefs, { name: key });
             if (defEntity && defEntity.typeName) {
                 var defEntityType = defEntity.typeName.toLocaleLowerCase();
-                if (defEntityType === 'date' || defEntityType === 'time') {
+                if (defEntityType === 'date') {
                     keyValue = new Date(keyValue);
                 } else if (_.isObject(keyValue)) {
                     keyValue = extractObject(keyValue);
@@ -219,12 +219,6 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
                 val = '<a target="_blank" class="blue-link" href="' + keyValue + '">' + keyValue + '</a>';
             } else if (key === 'guid' || key === "__guid") {
                 val = '<a title="' + key + '" href="#!/detailPage/' + keyValue + '">' + keyValue + '</a>';
-            } else if (key.toLocaleLowerCase().indexOf("time") !== -1 || key.toLocaleLowerCase().indexOf("date") !== -1) {
-                val = new Date(keyValue);
-
-                if (isNaN(val.getTime())) {
-                    val = _.escape(keyValue);
-                }
             } else {
                 val = _.escape(keyValue);
             }


[2/2] atlas git commit: ATLAS-2729: fix - audit logging fails for large entities

Posted by ma...@apache.org.
ATLAS-2729: fix - audit logging fails for large entities

(cherry picked from commit 92f3a91ec56538305043ba0980d3f7a8b477ec96)


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

Branch: refs/heads/branch-1.0
Commit: c542deb6d6bbc47a806525aa456b8ea522bd97f4
Parents: 80f0ef4
Author: Madhan Neethiraj <ma...@apache.org>
Authored: Thu May 31 14:22:52 2018 -0700
Committer: Madhan Neethiraj <ma...@apache.org>
Committed: Sun Jun 3 23:27:17 2018 -0700

----------------------------------------------------------------------
 .../repository/audit/EntityAuditListener.java   | 11 +++++++++
 .../repository/audit/EntityAuditListenerV2.java | 25 +++++++++++++++++++-
 2 files changed, 35 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/c542deb6/repository/src/main/java/org/apache/atlas/repository/audit/EntityAuditListener.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/audit/EntityAuditListener.java b/repository/src/main/java/org/apache/atlas/repository/audit/EntityAuditListener.java
index 27d121a..dfacb38 100644
--- a/repository/src/main/java/org/apache/atlas/repository/audit/EntityAuditListener.java
+++ b/repository/src/main/java/org/apache/atlas/repository/audit/EntityAuditListener.java
@@ -187,6 +187,17 @@ public class EntityAuditListener implements EntityChangeListener {
             entity.setValues(null);
 
             auditString = auditPrefix + AtlasType.toV1Json(entity);
+            auditBytes  = auditString.getBytes(StandardCharsets.UTF_8); // recheck auditString size
+            auditSize   = auditBytes != null ? auditBytes.length : 0;
+
+            if (auditMaxSize >= 0 && auditSize > auditMaxSize) { // don't store classifications as well
+                LOG.warn("audit record still too long: entityType={}, guid={}, size={}; maxSize={}. audit will have only summary details",
+                        entity.getTypeName(), entity.getId()._getId(), auditSize, auditMaxSize);
+
+                Referenceable shallowEntity = new Referenceable(entity.getId(), entity.getTypeName(), null, entity.getSystemAttributes(), null, null);
+
+                auditString = auditPrefix + AtlasType.toJson(shallowEntity);
+            }
 
             entity.setValues(attrValues);
         }

http://git-wip-us.apache.org/repos/asf/atlas/blob/c542deb6/repository/src/main/java/org/apache/atlas/repository/audit/EntityAuditListenerV2.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/audit/EntityAuditListenerV2.java b/repository/src/main/java/org/apache/atlas/repository/audit/EntityAuditListenerV2.java
index fe584e3..91e1f63 100644
--- a/repository/src/main/java/org/apache/atlas/repository/audit/EntityAuditListenerV2.java
+++ b/repository/src/main/java/org/apache/atlas/repository/audit/EntityAuditListenerV2.java
@@ -234,13 +234,36 @@ public class EntityAuditListenerV2 implements EntityChangeListenerV2 {
             LOG.warn("audit record too long: entityType={}, guid={}, size={}; maxSize={}. entity attribute values not stored in audit",
                     entity.getTypeName(), entity.getGuid(), auditSize, auditMaxSize);
 
-            Map<String, Object> attrValues = entity.getAttributes();
+            Map<String, Object> attrValues    = entity.getAttributes();
+            Map<String, Object> relAttrValues = entity.getRelationshipAttributes();
 
             entity.setAttributes(null);
+            entity.setRelationshipAttributes(null);
 
             auditString = auditPrefix + AtlasType.toJson(entity);
+            auditBytes  = auditString.getBytes(StandardCharsets.UTF_8); // recheck auditString size
+            auditSize   = auditBytes != null ? auditBytes.length : 0;
+
+            if (auditMaxSize >= 0 && auditSize > auditMaxSize) { // don't store classifications and meanings as well
+                LOG.warn("audit record still too long: entityType={}, guid={}, size={}; maxSize={}. audit will have only summary details",
+                        entity.getTypeName(), entity.getGuid(), auditSize, auditMaxSize);
+
+                AtlasEntity shallowEntity = new AtlasEntity();
+
+                shallowEntity.setGuid(entity.getGuid());
+                shallowEntity.setTypeName(entity.getTypeName());
+                shallowEntity.setCreateTime(entity.getCreateTime());
+                shallowEntity.setUpdateTime(entity.getUpdateTime());
+                shallowEntity.setCreatedBy(entity.getCreatedBy());
+                shallowEntity.setUpdatedBy(entity.getUpdatedBy());
+                shallowEntity.setStatus(entity.getStatus());
+                shallowEntity.setVersion(entity.getVersion());
+
+                auditString = auditPrefix + AtlasType.toJson(shallowEntity);
+            }
 
             entity.setAttributes(attrValues);
+            entity.setRelationshipAttributes(relAttrValues);
         }
 
         restoreEntityAttributes(entity, prunedAttributes);