@Override public void doRollbackTransaction(Graph currentTransaction) { if (currentTransaction instanceof TransactionalGraph) { ((TransactionalGraph) graph).rollback(); } }
public void rollback() { if (this.baseGraph instanceof TransactionalGraph) { ((TransactionalGraph) baseGraph).rollback(); } }
/** * Rollback the transaction. */ public void rollback() { if (graph != null) { graph.rollback(); } rolledBack = true; }
@Override public void rollback() { if (baseGraph instanceof TransactionalGraph) { final TransactionalGraph transactionalGraph = (TransactionalGraph) baseGraph; transactionalGraph.rollback(); } }
@Override public final void rollback(){ if (txBaseGraph != null) { txBaseGraph.rollback(); } }
@Override public void rollback() { getBaseGraph().rollback(); }
@Override public void rollback() { getBaseGraph().rollback(); }
/** * A rollback only resets the event queue on successful operation. If the rollback operation to the underlying * graph fails, the event queue will not be reset. */ public void rollback() { boolean transactionFailure = false; try { this.baseGraph.rollback(); } catch (RuntimeException re) { transactionFailure = true; throw re; } finally { if (!transactionFailure) { trigger.resetEventQueue(); } } } }
/** * A rollback only resets the event queue on successful operation. If the rollback operation to the underlying * graph fails, the event queue will not be reset. */ public void rollback() { boolean transactionFailure = false; try { this.baseGraph.rollback(); } catch (RuntimeException re) { transactionFailure = true; throw re; } finally { if (!transactionFailure) { trigger.resetEventQueue(); } } } }
public T execute(final TransactionalGraph graph, final TransactionWork<T> work) { T returnValue; try { returnValue = work.execute(graph); graph.commit(); } catch (Exception e) { graph.rollback(); throw new RuntimeException(e); } return returnValue; } }
public T execute(final TransactionalGraph graph, final TransactionWork<T> work) { T returnValue = null; try { returnValue = work.execute(graph); graph.commit(); } catch (Exception e) { graph.rollback(); } return returnValue; } }
@Override public void cleanup(final Mapper<NullWritable, FaunusVertex, LongWritable, Holder<FaunusVertex>>.Context context) throws IOException, InterruptedException { if (this.graph instanceof TransactionalGraph) { try { ((TransactionalGraph) this.graph).commit(); context.getCounter(Counters.SUCCESSFUL_TRANSACTIONS).increment(1l); } catch (Exception e) { LOGGER.error("Could not commit transaction during VertexMap.cleanup():", e); ((TransactionalGraph) this.graph).rollback(); context.getCounter(Counters.FAILED_TRANSACTIONS).increment(1l); throw new IOException(e.getMessage(), e); } } this.graph.shutdown(); }
@Override public void cleanup(final Mapper<NullWritable, FaunusVertex, NullWritable, FaunusVertex>.Context context) throws IOException, InterruptedException { if (this.graph instanceof TransactionalGraph) { try { ((TransactionalGraph) this.graph).commit(); context.getCounter(Counters.SUCCESSFUL_TRANSACTIONS).increment(1l); } catch (Exception e) { LOGGER.error("Could not commit transaction during EdgeMap.cleanup():", e); ((TransactionalGraph) this.graph).rollback(); context.getCounter(Counters.FAILED_TRANSACTIONS).increment(1l); throw new IOException(e.getMessage(), e); } } this.graph.shutdown(); }
/** * A rollback only resets the event queue on successful operation. If the * rollback operation to the underlying graph fails, the event queue will * not be reset. */ @Override public void rollback() { boolean transactionFailure = false; try { getBaseGraph().rollback(); } catch (RuntimeException re) { transactionFailure = true; throw re; } finally { if (!transactionFailure) { getEventableGraph().getTrigger().resetEventQueue(); transactionData.get().clear(); } } }
} catch (final Exception e) { if (this.graph instanceof TransactionalGraph) { ((TransactionalGraph) this.graph).rollback(); context.getCounter(Counters.FAILED_TRANSACTIONS).increment(1l);
@Override public void apply() { applyOutsideTx(); TransactionalGraph graph = db.rawTx(); setGraph(graph); try { applyInTx(); } catch (Throwable e) { log.error("Invoking rollback due to error", e); graph.rollback(); throw e; } finally { graph.shutdown(); } }
transactionFailure = true; log.error("Could not allocate next commit version, performing a rollback."); getBaseGraph().rollback();
@Override public void map(final NullWritable key, final FaunusVertex value, final Mapper<NullWritable, FaunusVertex, LongWritable, Holder<FaunusVertex>>.Context context) throws IOException, InterruptedException { try { // Read (and/or Write) FaunusVertex (and respective properties) to Blueprints Graph // Attempt to use the ID provided by Faunus final Vertex blueprintsVertex = this.getOrCreateVertex(value, context); // Propagate shell vertices with Blueprints ids this.shellVertex.reuse(value.getIdAsLong()); this.shellVertex.setProperty(BLUEPRINTS_ID, blueprintsVertex.getId()); // TODO: Might need to be OUT for the sake of unidirectional edges in Titan for (final Edge faunusEdge : value.getEdges(IN)) { this.longWritable.set((Long) faunusEdge.getVertex(OUT).getId()); context.write(this.longWritable, this.vertexHolder.set('s', this.shellVertex)); } this.longWritable.set(value.getIdAsLong()); value.getProperties().clear(); // no longer needed in reduce phase value.setProperty(BLUEPRINTS_ID, blueprintsVertex.getId()); // need this for id resolution in reduce phase value.removeEdges(Tokens.Action.DROP, IN); // no longer needed in second map phase context.write(this.longWritable, this.vertexHolder.set('v', value)); } catch (final Exception e) { if (this.graph instanceof TransactionalGraph) { ((TransactionalGraph) this.graph).rollback(); context.getCounter(Counters.FAILED_TRANSACTIONS).increment(1l); } throw new IOException(e.getMessage(), e); } }