/** * Create an read-only transaction, verify its metadata, and abort it. */ public void test_CREATE_TX_READ_ONLY_01() throws Exception { assertNotNull(m_mgr); assertNotNull(m_mgr.getTransactionManager()); final IRemoteTx tx = m_mgr.getTransactionManager().createTx( RemoteTransactionManager.READ_COMMITTED); try { assertTrue(tx.isActive()); assertTrue(tx.isReadOnly()); } finally { tx.abort(); } assertFalse(tx.isActive()); assertTrue(tx.isReadOnly()); }
@Override public void commit() throws RepositoryException { assertOpen(); // non-blocking. synchronized (remoteTx) { assertOpen(); // non-blocking. final IRemoteTx tx = remoteTx.get(); if (tx != null) { try { tx.commit(); remoteTx.set(null/* newValue */); } catch (RemoteTransactionNotFoundException e) { throw new UnknownTransactionStateException(e); } catch (RuntimeException e) { throw new UnknownTransactionStateException(e); } } } }
if (tx.isReadOnly()) { opts.addRequestParam("timestamp", Long.toString(tx.getReadsOnCommitTime())); opts.addRequestParam("timestamp", Long.toString(tx.getTxId()));
/** * Create an unisolated transaction and commit it. This should be a NOP since * nothing is written on the database. * * TODO Create an unisolated transaction, write on the transaction, commit * the transaction and verify that we can read back the write set after the * commit. Note that we can only write on the resulting transaction if the * namespace supports isolatable indices. */ public void test_CREATE_TX_UNISOLATED_02() throws Exception { assertNotNull(m_mgr); assertNotNull(m_mgr.getTransactionManager()); final IRemoteTx tx = m_mgr.getTransactionManager().createTx( RemoteTransactionManager.UNISOLATED); try { } finally { tx.commit(); } assertFalse(tx.isActive()); }
@Override public void run() { /* * Note: This invokes the tx.abort() without regard to whether or * not the connection is open (it will be closed since we closed * it before submitting this for execution). */ synchronized (remoteTx) { final IRemoteTx tx = remoteTx.get(); if (tx != null) { try { tx.abort(); } catch (RuntimeException e) { // Log and ignore. log.error(e, e); } catch (Exception e) { // Log and ignore. log.error(e, e); } finally { // Clear the reference since we are closing the conn. remoteTx.set(null/* newValue */); } } } } });
/** * Create an read-only transaction and commit it. This should be a NOP since * nothing is written on the database. * * TODO Actually read on the transaction. Verify that we do not see concurrent * updates. * * TODO Do something similar with read-historical transactions. Verify that * we do not see concurrent updates and that we do not see updates for commit * points after the transaction start (this is nearly the same thing, but we * also should create the read-only tx only once we know that a commit point * has been pinned and that subsequent commits have been applied and verify * that the new tx is also reading from the correct commit point.) */ public void test_CREATE_TX_READ_ONLY_02() throws Exception { assertNotNull(m_mgr); assertNotNull(m_mgr.getTransactionManager()); final IRemoteTx tx = m_mgr.getTransactionManager().createTx( RemoteTransactionManager.READ_COMMITTED); try { } finally { tx.commit(); } assertFalse(tx.isActive()); }
@Override public void rollback() throws RepositoryException { assertOpen(); // non-blocking. synchronized (remoteTx) { assertOpen(); // non-blocking. final IRemoteTx tx = remoteTx.get(); if (tx != null) { try { tx.abort(); remoteTx.set(null/* newValue */); } catch (RemoteTransactionNotFoundException e) { throw new UnknownTransactionStateException(e); } catch (Exception e) { throw new UnknownTransactionStateException(e); } } } }
/** * Create an unisolated transaction, verify its metadata, and abort it. */ public void test_CREATE_TX_UNISOLATED_01() throws Exception { assertNotNull(m_mgr); assertNotNull(m_mgr.getTransactionManager()); final IRemoteTx tx = m_mgr.getTransactionManager().createTx( RemoteTransactionManager.UNISOLATED); try { assertTrue(tx.isActive()); assertFalse(tx.isReadOnly()); } finally { tx.abort(); } assertFalse(tx.isActive()); assertFalse(tx.isReadOnly()); }
/** * Create an unisolated transaction and commit it. This should be a NOP since * nothing is written on the database. * * TODO Create an unisolated transaction, write on the transaction, commit * the transaction and verify that we can read back the write set after the * commit. Note that we can only write on the resulting transaction if the * namespace supports isolatable indices. */ public void test_CREATE_TX_UNISOLATED_02() throws Exception { assertNotNull(m_mgr); assertNotNull(m_mgr.getTransactionManager()); final IRemoteTx tx = m_mgr.getTransactionManager().createTx( RemoteTransactionManager.UNISOLATED); try { } finally { tx.commit(); } assertFalse(tx.isActive()); }
/** * Create an unisolated transaction, verify its metadata, and abort it. */ public void test_CREATE_TX_UNISOLATED_01() throws Exception { assertNotNull(m_mgr); assertNotNull(m_mgr.getTransactionManager()); final IRemoteTx tx = m_mgr.getTransactionManager().createTx( RemoteTransactionManager.UNISOLATED); try { assertTrue(tx.isActive()); assertFalse(tx.isReadOnly()); } finally { tx.abort(); } assertFalse(tx.isActive()); assertFalse(tx.isReadOnly()); }
/** * Create an read-only transaction and commit it. This should be a NOP since * nothing is written on the database. * * TODO Actually read on the transaction. Verify that we do not see concurrent * updates. * * TODO Do something similar with read-historical transactions. Verify that * we do not see concurrent updates and that we do not see updates for commit * points after the transaction start (this is nearly the same thing, but we * also should create the read-only tx only once we know that a commit point * has been pinned and that subsequent commits have been applied and verify * that the new tx is also reading from the correct commit point.) */ public void test_CREATE_TX_READ_ONLY_02() throws Exception { assertNotNull(m_mgr); assertNotNull(m_mgr.getTransactionManager()); final IRemoteTx tx = m_mgr.getTransactionManager().createTx( RemoteTransactionManager.READ_COMMITTED); try { } finally { tx.commit(); } assertFalse(tx.isActive()); }
/** * Create an read-only transaction, verify its metadata, and abort it. */ public void test_CREATE_TX_READ_ONLY_01() throws Exception { assertNotNull(m_mgr); assertNotNull(m_mgr.getTransactionManager()); final IRemoteTx tx = m_mgr.getTransactionManager().createTx( RemoteTransactionManager.READ_COMMITTED); try { assertTrue(tx.isActive()); assertTrue(tx.isReadOnly()); } finally { tx.abort(); } assertFalse(tx.isActive()); assertTrue(tx.isReadOnly()); }