/** Replay a journal onto a dataset */ public static void replay(Journal journal, DatasetGraphTDB dsg) { replay(journal, dsg.getConfig()) ; }
public static void replay(Transaction transaction) { if ( syslog.isDebugEnabled()) syslog.debug("Replay "+transaction.getLabel()) ; Journal journal = transaction.getJournal() ; DatasetGraphTDB dsg = transaction.getBaseDataset() ; // Currently, we (crudely) replay the whole journal. replay(journal, dsg.getConfig()) ; }
/** Flush the journal regardless - use with great case - do not use when transactions may be active. */ public void forceRecoverFromJournal() { JournalControl.recoverFromJournal(getBaseDataset().getConfig(), transactionManager.getJournal()); }
private DatasetGraphTDB buildReadonly() { BlockMgrBuilder blockMgrBuilder = new BlockMgrBuilderReadonly(); ObjectFileBuilder objectFileBuilder = new ObjectFileBuilderReadonly(); DatasetBuilderStd x = new DatasetBuilderStd(blockMgrBuilder, objectFileBuilder) ; DatasetGraphTDB dsg2 = x._build(dsg.getLocation(), dsg.getConfig().params, false, dsg.getReorderTransform()) ; return dsg2 ; }
private DatasetGraphTDB buildWritable() { BlockMgrBuilder blockMgrBuilder = new BlockMgrBuilderTx() ; ObjectFileBuilder objectFileBuilder = new ObjectFileBuilderTx(); DatasetBuilderStd x = new DatasetBuilderStd(blockMgrBuilder, objectFileBuilder); DatasetGraphTDB dsg2 = x._build(dsg.getLocation(), dsg.getConfig().params, true, dsg.getReorderTransform()) ; dsg2.getContext().putAll(dsg.getContext()) ; return dsg2 ; }
/** Recover a base storage DatasetGraph */ public static void recovery(DatasetGraphTDB dsg) { if ( dsg.getLocation().isMem() ) return ; // Do we need to recover? Journal journal = findJournal(dsg) ; if ( journal == null || journal.isEmpty() ) return ; recoverFromJournal(dsg.getConfig(), journal) ; journal.close(); // Recovery complete. Tidy up. Node journal files have already been handled. if ( journal.getFilename() != null ) { if ( FileOps.exists(journal.getFilename()) ) FileOps.delete(journal.getFilename()) ; } }
@Test public void params_reconnect_01() { // Create. StoreConnection.make(loc, null) ; // Drop. StoreConnection.expel(loc, true) ; // Reconnect StoreConnection.make(loc, null) ; StoreParams pLoc = StoreParamsCodec.read(loc) ; assertNull(pLoc) ; StoreParams pDB = StoreConnection.getExisting(loc).getBaseDataset().getConfig().params ; assertNotNull(pDB) ; // Should be the default setup. assertTrue(StoreParams.sameValues(pDft, pDB)) ; }
@Test public void params_reconnect_01() { // Create. StoreConnection.make(loc, null) ; // Drop. StoreConnection.expel(loc, true) ; // Reconnect StoreConnection.make(loc, null) ; StoreParams pLoc = StoreParamsCodec.read(loc) ; assertNull(pLoc) ; StoreParams pDB = StoreConnection.getExisting(loc).getBaseDataset().getConfig().params ; assertNotNull(pDB) ; // Should be the default setup. assertTrue(StoreParams.sameValues(pDft, pDB)) ; }
@Test public void params_reconnect_03() { // Create. StoreConnection.make(loc, pApp) ; // Drop. StoreConnection.expel(loc, true) ; // Reconnect StoreConnection.make(loc, pSpecial) ; //StoreParams pLoc = StoreParamsCodec.read(loc) ; //assertNotNull(pLoc) ; StoreParams pDB = StoreConnection.getExisting(loc).getBaseDataset().getConfig().params ; assertNotNull(pDB) ; // Should be the default setup, modified by pApp for cache sizes. assertFalse(StoreParams.sameValues(pApp, pDB)) ; assertFalse(StoreParams.sameValues(pSpecial, pDB)) ; // Check it's default-modified-by-special. assertEquals(pSpecial.getBlockReadCacheSize(), pDB.getBlockReadCacheSize()) ; assertNotEquals(pApp.getBlockReadCacheSize(), pDB.getBlockReadCacheSize()) ; assertNotEquals(pSpecial.getBlockSize(), pDB.getBlockSize()) ; assertEquals(pApp.getBlockSize(), pDB.getBlockSize()) ; }
@Test public void params_reconnect_03() { // Create. StoreConnection.make(loc, pApp) ; // Drop. StoreConnection.expel(loc, true) ; // Reconnect StoreConnection.make(loc, pSpecial) ; //StoreParams pLoc = StoreParamsCodec.read(loc) ; //assertNotNull(pLoc) ; StoreParams pDB = StoreConnection.getExisting(loc).getBaseDataset().getConfig().params ; assertNotNull(pDB) ; // Should be the default setup, modified by pApp for cache sizes. assertFalse(StoreParams.sameValues(pApp, pDB)) ; assertFalse(StoreParams.sameValues(pSpecial, pDB)) ; // Check it's default-modified-by-special. assertEquals(pSpecial.getBlockReadCacheSize(), pDB.getBlockReadCacheSize()) ; assertNotEquals(pApp.getBlockReadCacheSize(), pDB.getBlockReadCacheSize()) ; assertNotEquals(pSpecial.getBlockSize(), pDB.getBlockSize()) ; assertEquals(pApp.getBlockSize(), pDB.getBlockSize()) ; }
@Test public void params_reconnect_02() { // Create. StoreConnection.make(loc, null) ; // Drop. StoreConnection.expel(loc, true) ; // Reconnect StoreConnection.make(loc, pSpecial) ; //StoreParams pLoc = StoreParamsCodec.read(loc) ; //assertNotNull(pLoc) ; StoreParams pDB = StoreConnection.getExisting(loc).getBaseDataset().getConfig().params ; assertNotNull(pDB) ; // Should be the default setup, modified by pApp for cache sizes. assertFalse(StoreParams.sameValues(pDft, pDB)) ; assertFalse(StoreParams.sameValues(pSpecial, pDB)) ; // Check it's default-modified-by-special. assertEquals(pSpecial.getBlockReadCacheSize(), pDB.getBlockReadCacheSize()) ; assertNotEquals(pDft.getBlockReadCacheSize(), pDB.getBlockReadCacheSize()) ; assertNotEquals(pSpecial.getBlockSize(), pDB.getBlockSize()) ; assertEquals(pDft.getBlockSize(), pDB.getBlockSize()) ; }
@Test public void params_reconnect_02() { // Create. StoreConnection.make(loc, null) ; // Drop. StoreConnection.expel(loc, true) ; // Reconnect StoreConnection.make(loc, pSpecial) ; //StoreParams pLoc = StoreParamsCodec.read(loc) ; //assertNotNull(pLoc) ; StoreParams pDB = StoreConnection.getExisting(loc).getBaseDataset().getConfig().params ; assertNotNull(pDB) ; // Should be the default setup, modified by pApp for cache sizes. assertFalse(StoreParams.sameValues(pDft, pDB)) ; assertFalse(StoreParams.sameValues(pSpecial, pDB)) ; // Check it's default-modified-by-special. assertEquals(pSpecial.getBlockReadCacheSize(), pDB.getBlockReadCacheSize()) ; assertNotEquals(pDft.getBlockReadCacheSize(), pDB.getBlockReadCacheSize()) ; assertNotEquals(pSpecial.getBlockSize(), pDB.getBlockSize()) ; assertEquals(pDft.getBlockSize(), pDB.getBlockSize()) ; }