use of com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx in project titan by thinkaurelius.
the class CassandraGraphTest method testGraphConfigUsedByThreadBoundTx.
@Test
public void testGraphConfigUsedByThreadBoundTx() {
close();
WriteConfiguration wc = getConfiguration();
wc.set(ConfigElement.getPath(CASSANDRA_READ_CONSISTENCY), "ALL");
wc.set(ConfigElement.getPath(CASSANDRA_WRITE_CONSISTENCY), "LOCAL_QUORUM");
graph = (StandardTitanGraph) TitanFactory.open(wc);
StandardTitanTx tx = (StandardTitanTx) graph.getCurrentThreadTx();
assertEquals("ALL", tx.getTxHandle().getBaseTransactionConfig().getCustomOptions().get(AbstractCassandraStoreManager.CASSANDRA_READ_CONSISTENCY));
assertEquals("LOCAL_QUORUM", tx.getTxHandle().getBaseTransactionConfig().getCustomOptions().get(AbstractCassandraStoreManager.CASSANDRA_WRITE_CONSISTENCY));
}
use of com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx in project titan by thinkaurelius.
the class CassandraGraphTest method testGraphConfigUsedByTx.
@Test
public void testGraphConfigUsedByTx() {
close();
WriteConfiguration wc = getConfiguration();
wc.set(ConfigElement.getPath(CASSANDRA_READ_CONSISTENCY), "TWO");
wc.set(ConfigElement.getPath(CASSANDRA_WRITE_CONSISTENCY), "THREE");
graph = (StandardTitanGraph) TitanFactory.open(wc);
StandardTitanTx tx = (StandardTitanTx) graph.newTransaction();
assertEquals("TWO", tx.getTxHandle().getBaseTransactionConfig().getCustomOptions().get(AbstractCassandraStoreManager.CASSANDRA_READ_CONSISTENCY));
assertEquals("THREE", tx.getTxHandle().getBaseTransactionConfig().getCustomOptions().get(AbstractCassandraStoreManager.CASSANDRA_WRITE_CONSISTENCY));
tx.rollback();
}
use of com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx in project titan by thinkaurelius.
the class TitanH1OutputFormat method abort.
void abort(TaskAttemptID id) {
StandardTitanTx tx = transactions.remove(id);
if (null == tx) {
log.warn("Detected concurrency in task abort");
return;
}
tx.rollback();
}
use of com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx in project titan by thinkaurelius.
the class TitanH1OutputFormat method commit.
void commit(TaskAttemptID id) {
StandardTitanTx tx = transactions.remove(id);
if (null == tx) {
log.warn("Detected concurrency in task commit");
return;
}
tx.commit();
}
use of com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx in project titan by thinkaurelius.
the class IndexRemoveJob method getQueries.
@Override
public List<SliceQuery> getQueries() {
if (isGlobalGraphIndex()) {
//Everything
return ImmutableList.of(new SliceQuery(BufferUtil.zeroBuffer(1), BufferUtil.oneBuffer(128)));
} else {
RelationTypeIndexWrapper wrapper = (RelationTypeIndexWrapper) index;
InternalRelationType wrappedType = wrapper.getWrappedType();
Direction direction = null;
for (Direction dir : Direction.values()) if (wrappedType.isUnidirected(dir))
direction = dir;
assert direction != null;
StandardTitanTx tx = (StandardTitanTx) graph.get().buildTransaction().readOnly().start();
try {
QueryContainer qc = new QueryContainer(tx);
qc.addQuery().type(wrappedType).direction(direction).relations();
return qc.getSliceQueries();
} finally {
tx.rollback();
}
}
}
Aggregations