Commit ec94d2ad by Suma Shivaprasad

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

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