use of org.neo4j.io.fs.DefaultFileSystemAbstraction in project neo4j by neo4j.
the class StoreNodeRelationshipCursorTest method setupStores.
@BeforeClass
public static void setupStores() {
File storeDir = directory.absolutePath();
fs = new DefaultFileSystemAbstraction();
pageCache = new ConfiguringPageCacheFactory(fs, Config.defaults().augment(stringMap(pagecache_memory.name(), "8m")), NULL, PageCursorTracerSupplier.NULL, NullLog.getInstance()).getOrCreatePageCache();
StoreFactory storeFactory = new StoreFactory(storeDir, pageCache, fs, NullLogProvider.getInstance());
neoStores = storeFactory.openAllNeoStores(true);
}
use of org.neo4j.io.fs.DefaultFileSystemAbstraction in project neo4j by neo4j.
the class TestIndexProviderStore method createStore.
@Before
public void createStore() {
file = new File("target/test-data/index-provider-store");
fileSystem = new DefaultFileSystemAbstraction();
file.mkdirs();
fileSystem.deleteFile(file);
}
use of org.neo4j.io.fs.DefaultFileSystemAbstraction in project neo4j by neo4j.
the class NativeLabelScanStoreIT method before.
@Before
public void before() {
PageCache pageCache = pageCacheRule.getPageCache(new DefaultFileSystemAbstraction());
store = life.add(new NativeLabelScanStore(pageCache, directory.absolutePath(), FullStoreChangeStream.EMPTY, false, LabelScanStore.Monitor.EMPTY, // a bit of random pageSize
Math.min(pageCache.pageSize(), 256 << random.nextInt(5))));
}
use of org.neo4j.io.fs.DefaultFileSystemAbstraction in project neo4j by neo4j.
the class InMemoryCountsStoreCountsSnapshotSerializerIntegrationTest method largeWorkloadOnPhysicalLogTest.
@Test
public void largeWorkloadOnPhysicalLogTest() throws IOException {
//GIVEN
try (FileSystemAbstraction fs = new DefaultFileSystemAbstraction()) {
File tempFile = new File(testDir.directory(), "temp");
StoreChannel rawChannel = fs.create(tempFile);
Map<CountsKey, long[]> map = CountsStoreMapGenerator.simpleCountStoreMap(100000);
CountsSnapshot countsSnapshot = new CountsSnapshot(1, map);
CountsSnapshot recovered;
//WHEN
try (FlushableChannel tempChannel = new PhysicalFlushableChannel(rawChannel)) {
serialize(tempChannel, countsSnapshot);
}
// close() here is necessary to flush the temp buffer into the channel so we can read it next
// The try-with-resources closes the channel, need to reopen
rawChannel = fs.open(tempFile, "r");
try (ReadAheadChannel<StoreChannel> readAheadChannel = new ReadAheadChannel<>(rawChannel)) {
recovered = deserialize(readAheadChannel);
//THEN
Assert.assertEquals(countsSnapshot.getTxId(), recovered.getTxId());
for (Map.Entry<CountsKey, long[]> pair : countsSnapshot.getMap().entrySet()) {
long[] value = recovered.getMap().get(pair.getKey());
Assert.assertNotNull(value);
Assert.assertArrayEquals(value, pair.getValue());
}
for (Map.Entry<CountsKey, long[]> pair : recovered.getMap().entrySet()) {
long[] value = countsSnapshot.getMap().get(pair.getKey());
Assert.assertNotNull(value);
Assert.assertArrayEquals(value, pair.getValue());
}
}
}
}
use of org.neo4j.io.fs.DefaultFileSystemAbstraction in project neo4j by neo4j.
the class StartOldDbOnCurrentVersionAndCreateFusionIndexIT method create3_5Database.
@Disabled("Here as reference for how 3.5 db was created")
@Test
void create3_5Database() throws Exception {
Path storeDir = tempStoreDirectory();
DatabaseManagementServiceBuilder builder = new TestDatabaseManagementServiceBuilder(storeDir);
createIndexDataAndShutdown(builder, "lucene-1.0", Provider.LUCENE_10.label);
createIndexDataAndShutdown(builder, "lucene+native-1.0", Provider.FUSION_10.label);
createIndexDataAndShutdown(builder, "lucene+native-2.0", Provider.FUSION_20.label);
createIndexDataAndShutdown(builder, GraphDatabaseSettings.SchemaIndex.NATIVE_BTREE10.providerName(), Provider.BTREE_10.label, db -> {
try (Transaction tx = db.beginTx()) {
tx.execute("CALL db.index.fulltext.createNodeIndex('fts1', ['Fts1'], ['prop1'] )").close();
tx.execute("CALL db.index.fulltext.createNodeIndex('fts2', ['Fts2', 'Fts3'], ['prop1', 'prop2'] )").close();
tx.execute("CALL db.index.fulltext.createNodeIndex('fts3', ['Fts4'], ['prop1'], {eventually_consistent: 'true'} )").close();
tx.execute("CALL db.index.fulltext.createRelationshipIndex('fts4', ['FtsRel1', 'FtsRel2'], ['prop1', 'prop2'], " + "{eventually_consistent: 'true'} )").close();
tx.commit();
}
try (Transaction tx = db.beginTx()) {
tx.schema().awaitIndexesOnline(10, TimeUnit.MINUTES);
Node node = tx.createNode(Label.label("Fts1"), Label.label("Fts2"), Label.label("Fts3"), Label.label("Fts4"));
node.setProperty("prop1", "abc");
node.setProperty("prop2", "abc");
node.createRelationshipTo(node, RelationshipType.withName("FtsRel1")).setProperty("prop1", "abc");
node.createRelationshipTo(node, RelationshipType.withName("FtsRel2")).setProperty("prop2", "abc");
tx.commit();
}
try (Transaction tx = db.beginTx()) {
tx.execute("call db.index.fulltext.awaitEventuallyConsistentIndexRefresh").close();
tx.commit();
}
});
Path zipFile = storeDir.resolveSibling(storeDir.getFileName().toString() + ".zip");
ZipUtils.zip(new DefaultFileSystemAbstraction(), storeDir, zipFile);
System.out.println("Db created in " + zipFile.toAbsolutePath());
}
Aggregations