public void test_newTx_readOnly_releaseTimeRespectsReadsOnCommitTime() throws IOException {
  final Properties p=new Properties();
  p.setProperty(AbstractTransactionService.Options.MIN_RELEASE_AGE,"0");
  final MockTransactionService service=newFixture(p);
  try {
    assertEquals(0L,service.getMinReleaseAge());
    final long oldReleaseTime=service.getReleaseTime();
    assertEquals(0L,oldReleaseTime);
    final long tx0=service.newTx(ITx.UNISOLATED);
    final TxState txState0=service.getTxState(tx0);
    final long ts=service.nextTimestamp();
    assertTrue(ts > Math.abs(tx0));
    final long tx1=service.newTx(ITx.UNISOLATED);
    final TxState txState1=service.getTxState(tx0);
    assertTrue(ts < Math.abs(tx1));
    assertEquals(txState0.getReadsOnCommitTime(),txState1.getReadsOnCommitTime());
    service.commit(tx0);
    final long newReleaseTime=service.getReleaseTime();
    assertEquals(oldReleaseTime,newReleaseTime);
    service.newTx(ts);
  }
  finally {
    service.destroy();
  }
}

public void test_newTx_readOnly_releaseTimeRespectsReadsOnCommitTime ( ) throws IOException { final Properties p = new Properties ( ) ; p . setProperty ( AbstractTransactionService . Options . MIN_RELEASE_AGE , "0" ) ; final MockTransactionService service = newFixture ( p ) ; try { assertEquals ( 0L , service . getMinReleaseAge ( ) ) ; final long oldReleaseTime = service . getReleaseTime ( ) ; assertEquals ( 0L , oldReleaseTime ) ; final long tx0 = service . newTx ( ITx . UNISOLATED ) ; final TxState txState0 = service . getTxState ( tx0 ) ; final long ts = service . nextTimestamp ( ) ; assertTrue ( ts > Math . abs ( tx0 ) ) ; final long tx1 = service . newTx ( ITx . UNISOLATED ) ; final TxState txState1 = service . getTxState ( tx0 ) ; assertTrue ( ts < Math . abs ( tx1 ) ) ; assertEquals ( txState0 . getReadsOnCommitTime ( ) , txState1 . getReadsOnCommitTime ( ) ) ; service . commit ( tx0 ) ; final long newReleaseTime = service . getReleaseTime ( ) ; assertEquals ( oldReleaseTime , newReleaseTime ) ; service . newTx ( ts ) ; } finally { service . destroy ( ) ; } }
unit test verifies that the release time does not advance when the earliest running transaction terminates but a second transaction is still active which reads on the same commit time .
