private Transaction getCurrentTransaction() { return tx != null ? tx : txContext != null ? txContext.getCurrentTransaction() : null; }
@Override public void checkpoint(boolean hasUncommittedData) throws SQLException { if (hasUncommittedData) { try { if (txContext == null) { tx = txServiceClient.checkpoint(tx); } else { assert (txContext != null); txContext.checkpoint(); tx = txContext.getCurrentTransaction(); } } catch (TransactionFailureException e) { throw new SQLException(e); } } // Since we're querying our own table while mutating it, we must exclude // see our current mutations, otherwise we can get erroneous results // (for DELETE) // or get into an infinite loop (for UPSERT SELECT). if (txContext == null) { tx.setVisibility(VisibilityLevel.SNAPSHOT_EXCLUDE_CURRENT); } else { assert (txContext != null); txContext.getCurrentTransaction().setVisibility( VisibilityLevel.SNAPSHOT_EXCLUDE_CURRENT); } }
private Transaction getCurrentTransaction() { return tx != null ? tx : txContext != null ? txContext.getCurrentTransaction() : null; }
private Transaction getCurrentTransaction() { return tx != null ? tx : txContext != null ? txContext.getCurrentTransaction() : null; }
@Override public void checkpoint(boolean hasUncommittedData) throws SQLException { if (hasUncommittedData) { try { if (txContext == null) { tx = txServiceClient.checkpoint(tx); } else { assert (txContext != null); txContext.checkpoint(); tx = txContext.getCurrentTransaction(); } } catch (TransactionFailureException e) { throw new SQLException(e); } } // Since we're querying our own table while mutating it, we must exclude // see our current mutations, otherwise we can get erroneous results // (for DELETE) // or get into an infinite loop (for UPSERT SELECT). if (txContext == null) { tx.setVisibility(VisibilityLevel.SNAPSHOT_EXCLUDE_CURRENT); } else { assert (txContext != null); txContext.getCurrentTransaction().setVisibility( VisibilityLevel.SNAPSHOT_EXCLUDE_CURRENT); } }
@Override public void checkpoint(boolean hasUncommittedData) throws SQLException { if (hasUncommittedData) { try { if (txContext == null) { tx = txServiceClient.checkpoint(tx); } else { assert (txContext != null); txContext.checkpoint(); tx = txContext.getCurrentTransaction(); } } catch (TransactionFailureException e) { throw new SQLException(e); } } // Since we're querying our own table while mutating it, we must exclude // see our current mutations, otherwise we can get erroneous results // (for DELETE) // or get into an infinite loop (for UPSERT SELECT). if (txContext == null) { tx.setVisibility(VisibilityLevel.SNAPSHOT_EXCLUDE_CURRENT); } else { assert (txContext != null); txContext.getCurrentTransaction().setVisibility( VisibilityLevel.SNAPSHOT_EXCLUDE_CURRENT); } }
} catch (TransactionFailureException e) { Assert.assertEquals("start failure", e.getCause().getMessage()); Assert.assertNull(context.getCurrentTransaction()); Assert.assertEquals("changes failure", e.getCause().getMessage()); Assert.assertNull(context.getCurrentTransaction()); Assert.assertEquals("persist failure", e.getCause().getMessage()); Assert.assertNull(context.getCurrentTransaction()); Assert.assertEquals("rollback failure", e.getCause().getMessage()); Assert.assertNull(context.getCurrentTransaction()); Assert.assertEquals("post failure", e.getCause().getMessage()); Assert.assertNull(context.getCurrentTransaction()); Assert.assertNull(context.getCurrentTransaction());
Assert.assertNotNull(txContext.getCurrentTransaction()); Assert.assertEquals(txContext.getCurrentTransaction(), a.getCurrentTransaction()); Assert.assertEquals(txContext.getCurrentTransaction(), b.getCurrentTransaction()); txContext.abort();