public void delete(final long addr) { delete(addr, null/* IAllocationContext */); }
public void delete(final long addr) { delete(addr, null/* IAllocationContext */); }
@Override public void run() { for (int i = 0; i < 2000; i++) { bs.delete(addrs[r.nextInt(addrs.length)]); for (int w = 0; w < 1000; w++) bs.write(randomData(r.nextInt(500)+1)); bs.abort(); } } };
@Override public void run() { for (int i = 0; i < 2000; i++) { bs.delete(addrs[r.nextInt(addrs.length)]); for (int w = 0; w < 1000; w++) bs.write(randomData(r.nextInt(500)+1)); bs.abort(); } } };
/** * Tests whether tasks are able to access and modify data safely by * emulating transactions by calling activateTx and deactivateTx * directly. */ public void test_sessionProtection() { // Sequential logic final Journal store = (Journal) getStore(); try { final RWStrategy bs = (RWStrategy) store.getBufferStrategy(); final RWStore rw = bs.getStore(); final byte[] buf = new byte[300]; // Just some data r.nextBytes(buf); final ByteBuffer bb = ByteBuffer.wrap(buf); long faddr = bs.write(bb); // rw.alloc(buf, buf.length); IRawTx tx = rw.newTx(); bs.delete(faddr); // delettion protected by session bb.position(0); final ByteBuffer rdBuf = bs.read(faddr); // should be able to successfully read from freed address assertEquals(bb, rdBuf); tx.close(); store.commit(); } finally { store.destroy(); } }
/** * Tests whether tasks are able to access and modify data safely by * emulating transactions by calling activateTx and deactivateTx * directly. */ public void test_sessionProtection() { // Sequential logic final Journal store = (Journal) getStore(); try { final RWStrategy bs = (RWStrategy) store.getBufferStrategy(); final RWStore rw = bs.getStore(); final byte[] buf = new byte[300]; // Just some data r.nextBytes(buf); final ByteBuffer bb = ByteBuffer.wrap(buf); long faddr = bs.write(bb); // rw.alloc(buf, buf.length); IRawTx tx = rw.newTx(); bs.delete(faddr); // delettion protected by session bb.position(0); final ByteBuffer rdBuf = bs.read(faddr); // should be able to successfully read from freed address assertEquals(bb, rdBuf); tx.close(); store.commit(); } finally { store.destroy(); } }
public void test_allocCommitFreeWithHistory() { final Journal store = (Journal) getStore(4); try { final RWStrategy bs = (RWStrategy) store.getBufferStrategy(); final long addr = bs.write(randomData(78)); store.commit(); bs.delete(addr); assertTrue(bs.isCommitted(addr)); } finally { store.destroy(); } }
public void test_allocCommitFreeWithHistory() { final Journal store = (Journal) getStore(4); try { final RWStrategy bs = (RWStrategy) store.getBufferStrategy(); final long addr = bs.write(randomData(78)); store.commit(); bs.delete(addr); assertTrue(bs.isCommitted(addr)); } finally { store.destroy(); } }
/** * State1 * * Allocate - Commit - Free * * assert that allocation remains committed */ public void test_allocCommitFree() { Journal store = (Journal) getStore(); try { RWStrategy bs = (RWStrategy) store.getBufferStrategy(); final long addr = bs.write(randomData(78)); store.commit(); bs.delete(addr); assertTrue(bs.isCommitted(addr)); } finally { store.destroy(); } }
/** * State1 * * Allocate - Commit - Free * * assert that allocation remains committed */ public void test_allocCommitFree() { Journal store = (Journal) getStore(); try { RWStrategy bs = (RWStrategy) store.getBufferStrategy(); final long addr = bs.write(randomData(78)); store.commit(); bs.delete(addr); assertTrue(bs.isCommitted(addr)); } finally { store.destroy(); } }
/** * State2 * * Allocate - Commit - Free - Commit * * assert that allocation is no longer committed */ public void test_allocCommitFreeCommit() { Journal store = (Journal) getStore(); try { RWStrategy bs = (RWStrategy) store.getBufferStrategy(); final long addr = bs.write(randomData(78)); store.commit(); bs.delete(addr); assertTrue(bs.isCommitted(addr)); store.commit(); assertFalse(bs.isCommitted(addr)); } finally { store.destroy(); } }
/** * State2 * * Allocate - Commit - Free - Commit * * assert that allocation is no longer committed */ public void test_allocCommitFreeCommit() { Journal store = (Journal) getStore(); try { RWStrategy bs = (RWStrategy) store.getBufferStrategy(); final long addr = bs.write(randomData(78)); store.commit(); bs.delete(addr); assertTrue(bs.isCommitted(addr)); store.commit(); assertFalse(bs.isCommitted(addr)); } finally { store.destroy(); } }
public void test_allocCommitFreeCommitWriteCacheWithHistory() { final Journal store = (Journal) getStore(5); try { final RWStrategy bs = (RWStrategy) store.getBufferStrategy(); final long addr = bs.write(randomData(78)); // Has just been written so must be in cache assertTrue(bs.inWriteCache(addr)); store.commit(); bs.delete(addr); // since data is committed, should be accessible from any new // readCommitted transaction assertTrue(bs.inWriteCache(addr)); store.commit(); // Since state is retained, the delete is deferred assertTrue(bs.inWriteCache(addr)); } finally { store.destroy(); } }
public void test_allocCommitFreeCommitWriteCacheWithHistory() { final Journal store = (Journal) getStore(5); try { final RWStrategy bs = (RWStrategy) store.getBufferStrategy(); final long addr = bs.write(randomData(78)); // Has just been written so must be in cache assertTrue(bs.inWriteCache(addr)); store.commit(); bs.delete(addr); // since data is committed, should be accessible from any new // readCommitted transaction assertTrue(bs.inWriteCache(addr)); store.commit(); // Since state is retained, the delete is deferred assertTrue(bs.inWriteCache(addr)); } finally { store.destroy(); } }
bs.delete(addr);
bs.delete(addr);