use of org.neo4j.io.fs.DefaultFileSystemAbstraction in project neo4j by neo4j.
the class IdGeneratorImplTest method shouldForceStickyMark.
@Test
public void shouldForceStickyMark() throws Exception {
// GIVEN
try (FileSystemAbstraction fs = new DefaultFileSystemAbstraction()) {
File dir = new File("target/test-data/" + getClass().getName());
fs.mkdirs(dir);
File file = new File(dir, "ids");
fs.deleteFile(file);
IdGeneratorImpl.createGenerator(fs, file, 0, false);
// WHEN opening the id generator, where the jvm crashes right after
executeSubProcess(getClass(), 1, MINUTES, file.getAbsolutePath());
// THEN
try {
IdGeneratorImpl.readHighId(fs, file);
fail("Should have thrown, saying something with sticky generator");
} catch (InvalidIdGeneratorException e) {
// THEN Good
}
}
}
use of org.neo4j.io.fs.DefaultFileSystemAbstraction in project neo4j by neo4j.
the class MigrationTestUtils method prepareSampleLegacyDatabase.
public static void prepareSampleLegacyDatabase(String version, EphemeralFileSystemAbstraction workingFs, File workingDirectory, File realDirForPreparingDatabase) throws IOException {
try (DefaultFileSystemAbstraction fileSystemAbstraction = new DefaultFileSystemAbstraction()) {
File resourceDirectory = findFormatStoreDirectoryForVersion(version, realDirForPreparingDatabase);
workingFs.copyRecursivelyFromOtherFs(resourceDirectory, fileSystemAbstraction, workingDirectory);
}
}
use of org.neo4j.io.fs.DefaultFileSystemAbstraction in project neo4j by neo4j.
the class GraphStoreFixture method directStoreAccess.
public DirectStoreAccess directStoreAccess() {
if (directStoreAccess == null) {
fileSystem = new DefaultFileSystemAbstraction();
PageCache pageCache = getPageCache(fileSystem);
LogProvider logProvider = NullLogProvider.getInstance();
StoreFactory storeFactory = new StoreFactory(directory, pageCache, fileSystem, logProvider);
neoStore = storeFactory.openAllNeoStores();
StoreAccess nativeStores;
if (keepStatistics) {
AccessStatistics accessStatistics = new AccessStatistics();
statistics = new VerboseStatistics(accessStatistics, new DefaultCounts(defaultConsistencyCheckThreadsNumber()), NullLog.getInstance());
nativeStores = new AccessStatsKeepingStoreAccess(neoStore, accessStatistics);
} else {
statistics = Statistics.NONE;
nativeStores = new StoreAccess(neoStore);
}
nativeStores.initialize();
Config config = Config.empty();
OperationalMode operationalMode = OperationalMode.single;
IndexStoreView indexStoreView = new NeoStoreIndexStoreView(LockService.NO_LOCK_SERVICE, nativeStores.getRawNeoStores());
Dependencies dependencies = new Dependencies();
dependencies.satisfyDependencies(Config.defaults(), fileSystem, new SimpleLogService(logProvider, logProvider), indexStoreView, pageCache);
KernelContext kernelContext = new SimpleKernelContext(directory, UNKNOWN, dependencies);
LabelScanStore labelScanStore = startLabelScanStore(config, dependencies, kernelContext);
directStoreAccess = new DirectStoreAccess(nativeStores, labelScanStore, createIndexes(fileSystem, config, operationalMode));
}
return directStoreAccess;
}
use of org.neo4j.io.fs.DefaultFileSystemAbstraction in project neo4j by neo4j.
the class DumpStoreChain method dump.
void dump(File storeDir) throws IOException {
try (DefaultFileSystemAbstraction fs = new DefaultFileSystemAbstraction();
PageCache pageCache = createPageCache(fs)) {
DefaultIdGeneratorFactory idGeneratorFactory = new DefaultIdGeneratorFactory(fs);
Config config = Config.defaults();
StoreFactory storeFactory = new StoreFactory(storeDir, config, idGeneratorFactory, pageCache, fs, logProvider());
try (NeoStores neoStores = storeFactory.openNeoStores(getStoreTypes())) {
RecordStore<RECORD> store = store(neoStores);
RECORD record = store.newRecord();
for (long next = first; next != -1; ) {
store.getRecord(next, record, RecordLoad.FORCE);
System.out.println(record);
next = next(record);
}
}
}
}
use of org.neo4j.io.fs.DefaultFileSystemAbstraction in project neo4j by neo4j.
the class StoreMigration method main.
public static void main(String[] args) throws IOException {
Args arguments = Args.withFlags(HELP_FLAG).parse(args);
if (arguments.getBoolean(HELP_FLAG, false) || args.length == 0) {
printUsageAndExit();
}
File storeDir = parseDir(arguments);
FormattedLogProvider userLogProvider = FormattedLogProvider.toOutputStream(System.out);
try (FileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction()) {
new StoreMigration().run(fileSystem, storeDir, getMigrationConfig(), userLogProvider);
}
}
Aggregations