Search in sources :

Example 61 with DefaultFileSystemAbstraction

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);
}
Also used : DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) ConfiguringPageCacheFactory(org.neo4j.kernel.impl.pagecache.ConfiguringPageCacheFactory) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) File(java.io.File) BeforeClass(org.junit.BeforeClass)

Example 62 with DefaultFileSystemAbstraction

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);
}
Also used : DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) File(java.io.File) Before(org.junit.Before)

Example 63 with DefaultFileSystemAbstraction

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))));
}
Also used : DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) PageCache(org.neo4j.io.pagecache.PageCache) Before(org.junit.Before)

Example 64 with DefaultFileSystemAbstraction

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());
            }
        }
    }
}
Also used : DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) FileSystemAbstraction(org.neo4j.io.fs.FileSystemAbstraction) DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) PhysicalFlushableChannel(org.neo4j.kernel.impl.transaction.log.PhysicalFlushableChannel) StoreChannel(org.neo4j.io.fs.StoreChannel) CountsKey(org.neo4j.kernel.impl.store.counts.keys.CountsKey) FlushableChannel(org.neo4j.kernel.impl.transaction.log.FlushableChannel) PhysicalFlushableChannel(org.neo4j.kernel.impl.transaction.log.PhysicalFlushableChannel) File(java.io.File) Map(java.util.Map) ReadAheadChannel(org.neo4j.kernel.impl.transaction.log.ReadAheadChannel) Test(org.junit.Test)

Example 65 with DefaultFileSystemAbstraction

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());
}
Also used : Path(java.nio.file.Path) TestDatabaseManagementServiceBuilder(org.neo4j.test.TestDatabaseManagementServiceBuilder) DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) InternalTransaction(org.neo4j.kernel.impl.coreapi.InternalTransaction) Transaction(org.neo4j.graphdb.Transaction) KernelTransaction(org.neo4j.kernel.api.KernelTransaction) Node(org.neo4j.graphdb.Node) TestDatabaseManagementServiceBuilder(org.neo4j.test.TestDatabaseManagementServiceBuilder) DatabaseManagementServiceBuilder(org.neo4j.dbms.api.DatabaseManagementServiceBuilder) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Aggregations

DefaultFileSystemAbstraction (org.neo4j.io.fs.DefaultFileSystemAbstraction)82 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)43 File (java.io.File)24 Path (java.nio.file.Path)21 PageCache (org.neo4j.io.pagecache.PageCache)21 Test (org.junit.Test)14 Test (org.junit.jupiter.api.Test)13 IOException (java.io.IOException)12 DatabaseLayout (org.neo4j.io.layout.DatabaseLayout)11 Config (org.neo4j.kernel.configuration.Config)11 Config (org.neo4j.configuration.Config)9 ThreadPoolJobScheduler (org.neo4j.test.scheduler.ThreadPoolJobScheduler)8 GraphDatabaseService (org.neo4j.graphdb.GraphDatabaseService)7 Transaction (org.neo4j.graphdb.Transaction)7 PrintStream (java.io.PrintStream)6 Before (org.junit.Before)6 CommandFailed (org.neo4j.commandline.admin.CommandFailed)6 Args (org.neo4j.helpers.Args)6 StandalonePageCacheFactory.createPageCache (org.neo4j.io.pagecache.impl.muninn.StandalonePageCacheFactory.createPageCache)6 JobScheduler (org.neo4j.scheduler.JobScheduler)6