IRawStore ensureStreamStore(final IRawStore store) { return store instanceof Journal ? ((Journal) store).getBufferStrategy() : store; }
IRawStore ensureStreamStore(final IRawStore store) { return store instanceof Journal ? ((Journal) store).getBufferStrategy() : store; }
private long allocBatch(Journal store, int tsts, int min, int sze, int grp) { final RWStrategy bs = (RWStrategy) store.getBufferStrategy(); final byte[] buf = new byte[sze + 4]; // extra for checksum r.nextBytes(buf); for (int i = 0; i < grp; i++) { int alloc = min + r.nextInt(sze - min); ByteBuffer bb = ByteBuffer.wrap(buf, 0, alloc); bs.write(bb); } return 0L; }
private long allocBatch(Journal store, int tsts, int min, int sze, int grp) { final RWStrategy bs = (RWStrategy) store.getBufferStrategy(); final byte[] buf = new byte[sze + 4]; // extra for checksum r.nextBytes(buf); for (int i = 0; i < grp; i++) { int alloc = min + r.nextInt(sze - min); ByteBuffer bb = ByteBuffer.wrap(buf, 0, alloc); bs.write(bb); } return 0L; }
public void setUpComparisonTest(Properties properties) throws Exception { store = new Journal(properties).getBufferStrategy(); }
public void setUpComparisonTest(Properties properties) throws Exception { store = new Journal(properties).getBufferStrategy(); }
private void commitSomeData(final Journal store) { final IRWStrategy bs = (IRWStrategy) store.getBufferStrategy(); // final IStore rw = bs.getStore(); // byte[] buf = new byte[r.nextInt(1024)]; // extra for checksum final byte[] buf = new byte[863]; // extra for checksum r.nextBytes(buf); bs.write(ByteBuffer.wrap(buf)); store.commit(); }
private void commitSomeData(final Journal store) { final IRWStrategy bs = (IRWStrategy) store.getBufferStrategy(); // final IStore rw = bs.getStore(); // byte[] buf = new byte[r.nextInt(1024)]; // extra for checksum final byte[] buf = new byte[863]; // extra for checksum r.nextBytes(buf); bs.write(ByteBuffer.wrap(buf)); store.commit(); }
@Override protected void activateTx(final TxState state) { if (txLog.isInfoEnabled()) txLog.info("OPEN : txId=" + state.tx + ", readsOnCommitTime=" + state.getReadsOnCommitTime()); final IBufferStrategy bufferStrategy = Journal.this.getBufferStrategy(); if (bufferStrategy instanceof IHistoryManager) { final IRawTx tx = ((IHistoryManager)bufferStrategy).newTx(); if (m_rawTxs.put(state.tx, tx) != null) { throw new IllegalStateException( "Unexpected existing RawTx"); } } super.activateTx(state); }
static ProxyTestSuite createProxyTestSuite(final IIndexManager indexManager, final TestMode testMode) { final TestNanoSparqlServerWithProxyIndexManager<?> delegate = new TestNanoSparqlServerWithProxyIndexManager( null/* name */, indexManager, testMode); // !!!! THIS CLASS !!!! /* * Use a proxy test suite and specify the delegate. */ final ProxyTestSuite suite = new ProxyTestSuite(delegate, "NanoSparqlServer Proxied Test Suite: indexManager=" + indexManager.getClass().getSimpleName() + ", testMode=" + testMode + ", bufferMode=" + (indexManager instanceof Journal ? ((Journal) indexManager) .getBufferStrategy().getBufferMode() : "")); return suite; }
void showStore(final Journal store) { final RWStrategy bufferStrategy = (RWStrategy) store.getBufferStrategy(); final RWStore rw = bufferStrategy.getStore(); if (log.isInfoEnabled()) log.info("Fixed Allocators: " + rw.getFixedAllocatorCount() + ", heap allocated: " + rw.getFileStorage() + ", utilised bytes: " + rw.getAllocatedSlots() + ", file length: " + rw.getStoreFile().length()); }
void showStore(final Journal store) { final RWStrategy bufferStrategy = (RWStrategy) store.getBufferStrategy(); final RWStore rw = bufferStrategy.getStore(); if (log.isInfoEnabled()) log.info("Fixed Allocators: " + rw.getFixedAllocatorCount() + ", heap allocated: " + rw.getFileStorage() + ", utilised bytes: " + rw.getAllocatedSlots() + ", file length: " + rw.getStoreFile().length()); }
public void test_metaAlloc() { Journal store = (Journal) getStore(); try { final RWStrategy bs = (RWStrategy) store.getBufferStrategy(); final RWStore rw = bs.getStore(); long realAddr = 0; for (int i = 0; i < 100000; i++) { int allocAddr = rw.metaAlloc(); realAddr = rw.metaBit2Addr(allocAddr); } if(log.isInfoEnabled())log.info("metaAlloc lastAddr: " + realAddr); } finally { store.destroy(); } }
public void test_metaAlloc() { Journal store = (Journal) getStore(); try { final RWStrategy bs = (RWStrategy) store.getBufferStrategy(); final RWStore rw = bs.getStore(); long realAddr = 0; for (int i = 0; i < 100000; i++) { int allocAddr = rw.metaAlloc(); realAddr = rw.metaBit2Addr(allocAddr); } if(log.isInfoEnabled())log.info("metaAlloc lastAddr: " + realAddr); } finally { store.destroy(); } }
public void test_allocCommitFreeWithHistory() { final Properties properties = new Properties(getProperties()); properties.setProperty( AbstractTransactionService.Options.MIN_RELEASE_AGE, "100"); final Journal store = getJournal(properties); try { MemStrategy bs = (MemStrategy) 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 Properties properties = new Properties(getProperties()); properties.setProperty( AbstractTransactionService.Options.MIN_RELEASE_AGE, "100"); final Journal store = getJournal(properties); try { MemStrategy bs = (MemStrategy) 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(); } }
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_allocCommitFree() { final Journal store = getJournal(getProperties()); try { MemStrategy bs = (MemStrategy) store.getBufferStrategy(); final long addr = bs.write(randomData(78)); store.commit(); bs.delete(addr); assertTrue(bs.isCommitted(addr)); } finally { store.destroy(); } }
public void test_allocCommitFree() { final Journal store = getJournal(getProperties()); try { MemStrategy bs = (MemStrategy) store.getBufferStrategy(); final long addr = bs.write(randomData(78)); store.commit(); bs.delete(addr); assertTrue(bs.isCommitted(addr)); } finally { store.destroy(); } }