@Test public void testIdCounts() { makeVertexIndexedUniqueKey("uid", Integer.class); mgmt.setConsistency(mgmt.getGraphIndex("uid"), ConsistencyModifier.LOCK); finishSchema(); //Schema and relation id pools are tapped, Schema id pool twice because the renew is triggered. Each id acquisition requires 1 mutations and 2 reads verifyStoreMetrics(ID_STORE_NAME, SYSTEM_METRICS, ImmutableMap.of(M_MUTATE, 3l, M_GET_SLICE, 6l)); }
final String prop = "someProp"; makeKey(prop,Integer.class); finishSchema();
public void checkFastProperty(boolean fastProperty) { makeKey("uid",String.class); makeKey("name", String.class); makeKey("age", String.class); finishSchema(); clopen(option(GraphDatabaseConfiguration.PROPERTY_PREFETCHING), fastProperty); metricsPrefix = "checkFastProperty"+fastProperty; TitanTransaction tx = graph.buildTransaction().groupName(metricsPrefix).start(); TitanVertex v = tx.addVertex("uid", "v1", "age", 25, "name", "john"); tx.commit(); verifyStoreMetrics(EDGESTORE_NAME); verifyStoreMetrics(INDEXSTORE_NAME); verifyStoreMetrics(METRICS_STOREMANAGER_NAME, ImmutableMap.of(M_MUTATE, 1l)); tx = graph.buildTransaction().groupName(metricsPrefix).start(); v = getV(tx, v); assertEquals("v1",v.property("uid").value()); assertEquals("25",v.property("age").value()); assertEquals("john",v.property("name").value()); tx.commit(); if (fastProperty) verifyStoreMetrics(EDGESTORE_NAME, ImmutableMap.of(M_GET_SLICE, 2l)); else verifyStoreMetrics(EDGESTORE_NAME, ImmutableMap.of(M_GET_SLICE, 4l)); verifyStoreMetrics(INDEXSTORE_NAME); verifyStoreMetrics(METRICS_STOREMANAGER_NAME, ImmutableMap.of(M_MUTATE, 1l)); }
@Test public void checkPropertyLockingAndIndex() { PropertyKey uid = makeKey("uid",String.class); TitanGraphIndex index = mgmt.buildIndex("uid",Vertex.class).unique().addKey(uid).buildCompositeIndex(); mgmt.setConsistency(index, ConsistencyModifier.LOCK); mgmt.makePropertyKey("name").dataType(String.class).make(); mgmt.makePropertyKey("age").dataType(Integer.class).make(); finishSchema(); metricsPrefix = "checkPropertyLockingAndIndex"; TitanTransaction tx = graph.buildTransaction().groupName(metricsPrefix).start(); TitanVertex v = tx.addVertex("uid", "v1", "age", 25, "name", "john"); assertEquals(25,v.property("age").value()); tx.commit(); verifyStoreMetrics(EDGESTORE_NAME); verifyLockingOverwrite(INDEXSTORE_NAME, 1); verifyStoreMetrics(METRICS_STOREMANAGER_NAME, ImmutableMap.of(M_MUTATE, 1l)); resetMetrics(); tx = graph.buildTransaction().groupName(metricsPrefix).start(); v = Iterables.getOnlyElement(tx.query().has("uid", Cmp.EQUAL, "v1").vertices()); assertEquals(25,v.property("age").value()); tx.commit(); verifyStoreMetrics(EDGESTORE_NAME, ImmutableMap.of(M_GET_SLICE,1l)); verifyStoreMetrics(INDEXSTORE_NAME, ImmutableMap.of(M_GET_SLICE,1l)); verifyStoreMetrics(METRICS_STOREMANAGER_NAME); }
@Test public void testIdCounts() { makeVertexIndexedUniqueKey("uid",Integer.class); mgmt.setConsistency(mgmt.getGraphIndex("uid"),ConsistencyModifier.LOCK); finishSchema(); //Schema and relation id pools are tapped, Schema id pool twice because the renew is triggered. Each id acquisition requires 1 mutations and 2 reads verifyStoreMetrics(ID_STORE_NAME, SYSTEM_METRICS, ImmutableMap.of(M_MUTATE, 3l, M_GET_SLICE, 6l)); }
final String prop = "property"; makeKey(prop,Integer.class); finishSchema();
TitanGraphIndex index = mgmt.buildIndex("uid",Vertex.class).unique().addKey(uid).buildCompositeIndex(); mgmt.setConsistency(index, ConsistencyModifier.LOCK); finishSchema();