in transaction-client/src/main/java/org/apache/omid/transaction/AbstractTransactionManager.java [358:393]
private void commitLowLatencyTransaction(AbstractTransaction<? extends CellId> tx)
throws RollbackException, TransactionException {
try {
long commitTs = tsoClient.commit(tx.getStartTimestamp(), tx.getWriteSet(), tx.getConflictFreeWriteSet()).get();
boolean committed = commitTableWriter.atomicAddCommittedTransaction(tx.getStartTimestamp(),commitTs);
if (!committed) {
// Transaction has been invalidated by other client
rollback(tx);
commitTableClient.deleteCommitEntry(tx.getStartTimestamp());
rolledbackTxsCounter.inc();
throw new RollbackException("Transaction " + tx.getTransactionId() + " got invalidated");
}
certifyCommitForTx(tx, commitTs);
updateShadowCellsAndRemoveCommitTableEntry(tx, postCommitter);
} catch (ExecutionException e) {
if (e.getCause() instanceof AbortException) { // TSO reports Tx conflicts as AbortExceptions in the future
rollback(tx);
rolledbackTxsCounter.inc();
throw new RollbackException(tx.getStartTimestamp() + ": Conflicts detected in writeset", e.getCause());
}
if (e.getCause() instanceof ServiceUnavailableException || e.getCause() instanceof ConnectionException) {
errorTxsCounter.inc();
rollback(tx); // Rollback proactively cause it's likely that a new TSOServer is now master
throw new RollbackException(tx.getStartTimestamp() + " rolled-back precautionary", e.getCause());
} else {
throw new TransactionException(tx.getStartTimestamp() + ": cannot determine Tx outcome", e.getCause());
}
} catch (InterruptedException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}