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/18 22:46:12 UTC

incubator-atlas git commit: ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)

Repository: incubator-atlas
Updated Branches:
  refs/heads/master 64f017a70 -> ec94d2ad1


ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)


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

Branch: refs/heads/master
Commit: ec94d2ad169f92feb9005ca1dc06845216c77055
Parents: 64f017a
Author: Suma Shivaprasad <su...@gmail.com>
Authored: Thu Aug 18 15:46:00 2016 -0700
Committer: Suma Shivaprasad <su...@gmail.com>
Committed: Thu Aug 18 15:46:00 2016 -0700

----------------------------------------------------------------------
 release-log.txt                                 |  1 +
 .../atlas/GraphTransactionInterceptor.java      | 16 ++++++++++++-
 .../atlas/repository/graph/GraphHelper.java     |  2 +-
 .../GraphBackedDiscoveryServiceTest.java        | 25 ++++++++++++++++++++
 4 files changed, 42 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec94d2ad/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 4469c81..f5e3441 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -7,6 +7,7 @@ ATLAS-674 Falcon Hook should use timestamps instead of long(ayubkhan via sumasai
 ATLAS-675 Storm Hook should use timetsamps as Date type instead of Long (ayubkhan via sumasai)
 ATLAS-1122 Change trait edge labels to have trait name alone (sumasai)
 ATLAS-1060 Add composite indexes for exact match performance improvements for all attributes (sumasai via shwethags)
+ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
 
 ALL CHANGES:
 ATLAS-1126 Fix NPE in getSchema calls (sumasai)

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec94d2ad/repository/src/main/java/org/apache/atlas/GraphTransactionInterceptor.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/GraphTransactionInterceptor.java b/repository/src/main/java/org/apache/atlas/GraphTransactionInterceptor.java
index 20e8ebc..fff8925 100644
--- a/repository/src/main/java/org/apache/atlas/GraphTransactionInterceptor.java
+++ b/repository/src/main/java/org/apache/atlas/GraphTransactionInterceptor.java
@@ -22,6 +22,8 @@ import com.thinkaurelius.titan.core.TitanGraph;
 import org.aopalliance.intercept.MethodInterceptor;
 import org.aopalliance.intercept.MethodInvocation;
 import org.apache.atlas.repository.graph.GraphProvider;
+import org.apache.atlas.typesystem.exception.EntityNotFoundException;
+import org.apache.atlas.typesystem.exception.SchemaNotFoundException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -45,8 +47,20 @@ public class GraphTransactionInterceptor implements MethodInterceptor {
             return response;
         } catch (Throwable t) {
             titanGraph.rollback();
-            LOG.error("graph rollback due to exception ", t);
+
+            if (logException(t)) {
+                LOG.error("graph rollback due to exception ", t);
+            } else {
+                LOG.error("graph rollback due to exception " + t.getClass().getSimpleName() + ":" + t.getMessage());
+            }
             throw t;
         }
     }
+
+    boolean logException(Throwable t) {
+        if ((t instanceof SchemaNotFoundException) || (t instanceof EntityNotFoundException)) {
+            return false;
+        }
+        return true;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec94d2ad/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java b/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
index 7072870..1ce87c9 100755
--- a/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
@@ -736,7 +736,7 @@ public final class GraphHelper {
 
         case Constants.TIMESTAMP_PROPERTY_KEY:
         case Constants.MODIFICATION_TIMESTAMP_PROPERTY_KEY:
-            return TypesUtil.newAttributeInfo(field, DataTypes.LONG_TYPE);
+            return TypesUtil.newAttributeInfo(field, DataTypes.DATE_TYPE);
         }
         return null;
     }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ec94d2ad/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java b/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java
index 74438cd..8a40110 100755
--- a/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java
+++ b/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java
@@ -162,6 +162,31 @@ public class GraphBackedDiscoveryServiceTest extends BaseRepositoryTest {
         rows = results.getJSONArray("rows");
         assertNotNull(rows);
         assertEquals(rows.length(), 1);
+
+        final String testTs = "\"2011-11-01T02:35:58.440Z\"";
+        dslQuery = "Department where " + Constants.TIMESTAMP_PROPERTY_KEY + " > " + testTs;
+        jsonResults = searchByDSL(dslQuery);
+        assertNotNull(jsonResults);
+
+        results = new JSONObject(jsonResults);
+        assertEquals(results.length(), 3);
+
+        rows = results.getJSONArray("rows");
+        assertNotNull(rows);
+        assertEquals(rows.length(), 1);
+
+
+        dslQuery = "Department where " + Constants.MODIFICATION_TIMESTAMP_PROPERTY_KEY + " > " + testTs;
+        jsonResults = searchByDSL(dslQuery);
+        assertNotNull(jsonResults);
+
+        results = new JSONObject(jsonResults);
+        assertEquals(results.length(), 3);
+
+        rows = results.getJSONArray("rows");
+        assertNotNull(rows);
+        assertEquals(rows.length(), 1);
+
     }
 
     @Test