static private Journal getTemporaryJournal() { final Properties properties = new Properties(); properties.setProperty(com.bigdata.journal.Options.BUFFER_MODE, BufferMode.Transient.toString()); properties.setProperty(com.bigdata.journal.Options.INITIAL_EXTENT, "" + (Bytes.megabyte32 * 1)); return new Journal(properties); }
public void test_stressAlloc() { Journal store = (Journal) getStore(); try { final RWStrategy bs = (RWStrategy) store.getBufferStrategy(); final RWStore rw = bs.getStore(); // long realAddr = 0; // allocBatch(store, 1, 32, 650, 100000000); allocBatch(store, 1, 32, 650, 50000); store.commit(); final StringBuilder str = new StringBuilder(); rw.showAllocators(str); if(log.isInfoEnabled())log.info(str); store.close(); if(log.isInfoEnabled())log.info("Re-open Journal"); store = (Journal) getStore(); showStore(store); } finally { store.destroy(); } }
/** * {@inheritDoc} * <p> * Setup sampling on the client's thread pool. */ @Override public void startService(final Journal indexManager) { final boolean collectQueueStatistics = Boolean.valueOf(indexManager .getProperty(Options.COLLECT_QUEUE_STATISTICS, Options.DEFAULT_COLLECT_QUEUE_STATISTICS)); if (log.isInfoEnabled()) log.info(Options.COLLECT_QUEUE_STATISTICS + "=" + collectQueueStatistics); if (!collectQueueStatistics) { return; } final long initialDelay = 0; // initial delay in ms. final long delay = 1000; // delay in ms. final TimeUnit unit = TimeUnit.MILLISECONDS; synchronized (this) { queueSampleTask = new ThreadPoolExecutorBaseStatisticsTask( (ThreadPoolExecutor) indexManager.getExecutorService()); scheduledFuture = indexManager.addScheduledTask(queueSampleTask, initialDelay, delay, unit); } }
public void test_shutdownNow() { final Journal journal = new Journal(getProperties()); try { journal.shutdownNow(); } finally { journal.destroy(); } }
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(); }
final Journal store = new Journal(properties); "testIndex", UUID.randomUUID()); store.registerIndex(indexMetadata); store.commit(); store.getIndex("testIndex")); final List<Future<Void>> futures = store.getExecutorService() .invokeAll(tasks); store.commit(); 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(); } }
try { final RWStrategy bs = (RWStrategy) store.getBufferStrategy(); final RWStore rw = bs.getStore(); addrs.add(bs.write(randomData(2048))); store.commit(); rw.resetFromHARootBlock(store.getRootBlockView()); store.read(addr); store.close(); store.destroy();
src.registerIndex(new IndexMetadata(NAME, UUID.randomUUID())); final BTree ndx = src.getIndex(NAME); src.commit(); src.destroy();
final Journal journal = new Journal(getProperties()); if (!journal.isStable()) { final File file = journal.getFile(); final Properties p = new Properties(journal.getProperties()); journal.destroy();
m_indexManager = new Journal(journalProperties); m_indexManager.getExecutorService());
/** * Dump a journal with a single named index. */ public void test_journal_oneIndexNoData() throws IOException, InterruptedException, ExecutionException { final Journal src = getStore(getProperties()); try { // register an index and commit the journal. final String NAME = "testIndex"; src.registerIndex(new IndexMetadata(NAME, UUID.randomUUID())); src.commit(); new DumpJournal(src) .dumpJournal(true/* dumpHistory */, true/* dumpPages */, true/* dumpIndices */, true/* showTuples */); } finally { src.destroy(); } }
final Journal journal = new Journal(properties); System.err.println("createTime="+journal.getRootBlockView().getCreateTime()); System.err.println("lastCommitTime="+journal.getLastCommitTime()); .getResourceLocator().locate(namespace, timestamp);
.toString()); j1 = new Journal(properties); ts1 = (AbstractTripleStore) j1.getResourceLocator().locate( namespace, TimestampUtility.asHistoricalRead(j1 .getLastCommitTime())); .toString()); j2 = new Journal(properties); ts2 = (AbstractTripleStore) j2.getResourceLocator().locate( namespace, TimestampUtility.asHistoricalRead(j2 .getLastCommitTime())); j1.close(); j2.close();
public void testSimpleReset() { final Properties properties = new Properties(getProperties()); final Journal store = (Journal) getStore(properties); try { final RWStrategy bs = (RWStrategy) store.getBufferStrategy(); final RWStore rw = bs.getStore(); for (int r = 0; r < 10; r++) { ArrayList<Long> addrs = new ArrayList<Long>(); for (int i = 0; i < 1000; i++) { addrs.add(bs.write(randomData(2048))); } rw.reset(); } final String fname = bs.getStore().getStoreFile().getAbsolutePath(); store.close(); } finally { store.destroy(); } }
resourceLocator = newResourceLocator(); localTransactionManager = newLocalTransactionManager(); getExecutorService().execute(new StartDeferredTasksTask()); if (isGroupCommit() && !(this.isHAJournal()) && getRootBlockView().getCommitCounter() == 0L) { getGlobalRowStore(); // Force the GRS index to exist. commit(); // Commit.
final RWStore rws = ((RWStrategy) jnl.getBufferStrategy()) .getStore(); jnl.commit(); jnl.close();
protected void destroy() { if (jnl != null) { jnl.destroy(); jnl = null; } }
/** * Test the index write rate for a fully isolated transaction using 32 bit * integer keys and 128 byte values for the index entries. */ public void testIsolatedIndexWriteRate() throws IOException { // register named index that can support isolation. String name = "abc"; final BTree btree; { IndexMetadata metadata = new IndexMetadata(UUID.randomUUID()); metadata.setBranchingFactor(getBranchingFactor()); metadata.setIsolatable(true); btree = BTree.create(journal, metadata); } journal.registerIndex(name, btree ); journal.commit(); // fully isolated transaction. long tx = journal.newTx(ITx.UNISOLATED); // run test. doIndexWriteRateTest(name, tx, 128); }
jnl.commit(); this.rel = (R) jnl.getResourceLocator().locate(namespace, ITx.READ_COMMITTED);