public FileSystemAbstraction fileSystem() { return fs.get(); }
private void crashAndRestart() throws Exception { fsRule.snapshot( db::shutdown ); db = newDb(); }
@Override public Statement apply( Statement base, Description description ) { return fs.apply( testDirectory.apply( pageCacheRule.apply( lifeStatement( base, description ), description ), description ), description ); }
@Test( expected = ToolFailureException.class ) public void failOnNotCleanlyShutdownStoreWithLogsInCustomRelativeLocation() throws Exception { File customConfigFile = testDirectory.file( "customConfig" ); Config customConfig = Config.defaults( logical_logs_location, "otherLocation" ); createGraphDbAndKillIt( customConfig ); MapUtil.store( customConfig.getRaw(), fs.openAsOutputStream( customConfigFile, false ) ); String[] args = {testDirectory.databaseDir().getPath(), "-config", customConfigFile.getPath()}; runConsistencyCheckToolWith( fs.get(), args ); }
@Test public void testStartEntryWrittenOnceOnRollback() throws Exception { File storeDir = testDirectory.databaseDir(); final GraphDatabaseService db = new TestGraphDatabaseFactory().setFileSystem( fs.get() ).newImpermanentDatabase( storeDir ); createSomeTransactions( db ); EphemeralFileSystemAbstraction snapshot = fs.snapshot( db::shutdown ); new TestGraphDatabaseFactory().setFileSystem( snapshot ).newImpermanentDatabase( storeDir ).shutdown(); }
@Test public void shouldNotAccidentallyDeleteStoreFilesIfNoMigrationWasRequired() throws IOException { // given CountsMigrator migrator = new CountsMigrator( fs, null, Config.defaults() ); DatabaseLayout sourceLayout = directory.databaseLayout(); File countsStoreFileA = sourceLayout.countStoreA(); File countsStoreFileB = sourceLayout.countStoreB(); fs.create( countsStoreFileA ); fs.create( countsStoreFileB ); DatabaseLayout migrationLayout = directory.databaseLayout( "migration" ); String versionToMigrateFrom = StoreVersion.STANDARD_V3_2.versionString(); String versionToMigrateTo = StoreVersion.STANDARD_V3_4.versionString(); migrator.migrate( sourceLayout, migrationLayout, SilentProgressReporter.INSTANCE, versionToMigrateFrom, versionToMigrateTo ); assertEquals( "Invalid test assumption: There should not have been migration for those versions", 0, migrationLayout.listDatabaseFiles( ( dir, name ) -> true ).length ); // when migrator.moveMigratedFiles( migrationLayout, sourceLayout, versionToMigrateFrom, versionToMigrateTo ); // then assertTrue( fs.fileExists( countsStoreFileA ) ); assertTrue( fs.fileExists( countsStoreFileB ) ); } }
@Override public Statement apply( Statement base, Description description ) { if ( chain == null ) { if ( fs == null ) { fs = new EphemeralFileSystemRule(); } this.pageCacheRule = new PageCacheRule( pageCacheConfig ); this.directory = TestDirectory.testDirectory( clazz, fs ); this.chain = RuleChain.outerRule( fs ).around( directory ).around( pageCacheRule ); } return chain.apply( base, description ); }
private void createGraphDbAndKillIt( Config config ) throws Exception { final GraphDatabaseService db = new TestGraphDatabaseFactory() .setFileSystem( fs.get() ) .newImpermanentDatabaseBuilder( testDirectory.databaseDir() ) .setConfig( config.getRaw() ) .newGraphDatabase(); try ( Transaction tx = db.beginTx() ) { db.createNode( label( "FOO" ) ); db.createNode( label( "BAR" ) ); tx.success(); } fs.snapshot( db::shutdown ); }
@Before public void doBefore() { fs = fsRule.get(); }
.setFileSystem( fs.get() ).newImpermanentDatabaseBuilder( testDir.databaseDir() ) .setConfig( GraphDatabaseSettings.record_id_batch_size, "1" ) .newGraphDatabase(); long checksumBefore = fs.get().checksum(); long checksumBefore2 = fs.get().checksum(); EphemeralFileSystemAbstraction snapshot = fs.snapshot( db::shutdown ); fs.get().dumpZip( out );
private void killDb() throws Exception { if ( db != null ) { fs.snapshot( () -> { db.shutdown(); db = null; } ); } }
@Before public void doBefore() { fs = fsRule.get(); }
private void killDb() throws Exception { if ( db != null ) { fs.snapshot( () -> { db.shutdown(); db = null; } ); } }
@Before public void doBefore() { fs = fsRule.get(); }
@SuppressWarnings( "deprecation" ) private void crashAndRestart() throws Exception { final GraphDatabaseService db1 = db; FileSystemAbstraction uncleanFs = fsRule.snapshot( db1::shutdown ); db = (GraphDatabaseAPI) databaseFactory( uncleanFs ).newImpermanentDatabase(); } }
private StoreChannel getStoreChannel() throws IOException { return fs.get().open( new File( "id.file" ), OpenMode.READ_WRITE ); } }
private void crashAndRestart() throws Exception { final GraphDatabaseService db1 = db; FileSystemAbstraction uncleanFs = fsRule.snapshot( db1::shutdown ); db = databaseFactory( uncleanFs ).newImpermanentDatabase(); }
private PageCache createPageCache() { return pageCacheRule.getPageCache( fs.get() ); }
fs.snapshot( throwing( () ->