Search in sources :

Example 36 with StoreFactory

use of org.neo4j.kernel.impl.store.StoreFactory in project neo4j by neo4j.

the class CoreBootstrapper method bootstrap.

public CoreSnapshot bootstrap(Set<MemberId> members) throws IOException {
    StoreFactory factory = new StoreFactory(storeDir, config, new DefaultIdGeneratorFactory(fs), pageCache, fs, logProvider);
    NeoStores neoStores = factory.openAllNeoStores(true);
    neoStores.close();
    CoreSnapshot coreSnapshot = new CoreSnapshot(FIRST_INDEX, FIRST_TERM);
    coreSnapshot.add(CoreStateType.ID_ALLOCATION, deriveIdAllocationState(storeDir));
    coreSnapshot.add(CoreStateType.LOCK_TOKEN, new ReplicatedLockTokenState());
    coreSnapshot.add(CoreStateType.RAFT_CORE_STATE, new RaftCoreState(new MembershipEntry(FIRST_INDEX, members)));
    coreSnapshot.add(CoreStateType.SESSION_TRACKER, new GlobalSessionTrackerState());
    appendNullTransactionLogEntryToSetRaftIndexToMinusOne();
    return coreSnapshot;
}
Also used : CoreSnapshot(org.neo4j.causalclustering.core.state.snapshot.CoreSnapshot) MembershipEntry(org.neo4j.causalclustering.core.consensus.membership.MembershipEntry) RaftCoreState(org.neo4j.causalclustering.core.state.snapshot.RaftCoreState) NeoStores(org.neo4j.kernel.impl.store.NeoStores) DefaultIdGeneratorFactory(org.neo4j.kernel.impl.store.id.DefaultIdGeneratorFactory) ReplicatedLockTokenState(org.neo4j.causalclustering.core.state.machines.locks.ReplicatedLockTokenState) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) GlobalSessionTrackerState(org.neo4j.causalclustering.core.replication.session.GlobalSessionTrackerState)

Example 37 with StoreFactory

use of org.neo4j.kernel.impl.store.StoreFactory in project neo4j by neo4j.

the class StoreMigratorFrom20IT method shouldMigrate.

@Test
public void shouldMigrate() throws IOException, ConsistencyCheckIncompleteException {
    // WHEN
    StoreMigrator storeMigrator = new StoreMigrator(fs, pageCache, getConfig(), NullLogService.getInstance(), schemaIndexProvider);
    SchemaIndexMigrator indexMigrator = new SchemaIndexMigrator(fs, schemaIndexProvider, labelScanStoreProvider);
    upgrader(indexMigrator, storeMigrator).migrateIfNeeded(find20FormatStoreDirectory(storeDir.directory()));
    // THEN
    assertEquals(2, monitor.progresses().size());
    assertTrue(monitor.isStarted());
    assertTrue(monitor.isFinished());
    GraphDatabaseService database = new EnterpriseGraphDatabaseFactory().newEmbeddedDatabaseBuilder(storeDir.absolutePath()).newGraphDatabase();
    try {
        verifyDatabaseContents(database);
    } finally {
        // CLEANUP
        database.shutdown();
    }
    LogProvider logProvider = NullLogProvider.getInstance();
    StoreFactory storeFactory = new StoreFactory(storeDir.directory(), pageCache, fs, logProvider);
    try (NeoStores neoStores = storeFactory.openAllNeoStores(true)) {
        verifyNeoStore(neoStores);
    }
    assertConsistentStore(storeDir.directory());
}
Also used : GraphDatabaseService(org.neo4j.graphdb.GraphDatabaseService) NullLogProvider(org.neo4j.logging.NullLogProvider) LogProvider(org.neo4j.logging.LogProvider) EnterpriseGraphDatabaseFactory(org.neo4j.graphdb.factory.EnterpriseGraphDatabaseFactory) NeoStores(org.neo4j.kernel.impl.store.NeoStores) StoreMigrator(org.neo4j.kernel.impl.storemigration.participant.StoreMigrator) SchemaIndexMigrator(org.neo4j.kernel.impl.storemigration.participant.SchemaIndexMigrator) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) Test(org.junit.Test)

Example 38 with StoreFactory

use of org.neo4j.kernel.impl.store.StoreFactory in project neo4j by neo4j.

the class NodeLabelsFieldTest method startUp.

@Before
public void startUp() {
    File storeDir = new File("dir");
    fs.get().mkdirs(storeDir);
    Config config = Config.embeddedDefaults(stringMap(GraphDatabaseSettings.label_block_size.name(), "60"));
    StoreFactory storeFactory = new StoreFactory(storeDir, config, new DefaultIdGeneratorFactory(fs.get()), pageCacheRule.getPageCache(fs.get()), fs.get(), NullLogProvider.getInstance());
    neoStores = storeFactory.openAllNeoStores(true);
    nodeStore = neoStores.getNodeStore();
}
Also used : Config(org.neo4j.kernel.configuration.Config) DefaultIdGeneratorFactory(org.neo4j.kernel.impl.store.id.DefaultIdGeneratorFactory) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) File(java.io.File) Before(org.junit.Before)

Example 39 with StoreFactory

use of org.neo4j.kernel.impl.store.StoreFactory in project neo4j by neo4j.

the class ApplyRecoveredTransactionsTest method before.

@Before
public void before() {
    FileSystemAbstraction fs = fsr.get();
    File storeDir = new File("dir");
    StoreFactory storeFactory = new StoreFactory(storeDir, Config.empty(), new DefaultIdGeneratorFactory(fs), pageCacheRule.getPageCache(fs), fs, NullLogProvider.getInstance());
    neoStores = storeFactory.openAllNeoStores(true);
}
Also used : FileSystemAbstraction(org.neo4j.io.fs.FileSystemAbstraction) DefaultIdGeneratorFactory(org.neo4j.kernel.impl.store.id.DefaultIdGeneratorFactory) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) File(java.io.File) Before(org.junit.Before)

Example 40 with StoreFactory

use of org.neo4j.kernel.impl.store.StoreFactory in project neo4j by neo4j.

the class NodeCommandTest method before.

@Before
public void before() throws Exception {
    File dir = new File("dir");
    fs.get().mkdirs(dir);
    @SuppressWarnings("deprecation") StoreFactory storeFactory = new StoreFactory(dir, Config.empty(), new DefaultIdGeneratorFactory(fs.get()), pageCacheRule.getPageCache(fs.get()), fs.get(), NullLogProvider.getInstance());
    neoStores = storeFactory.openAllNeoStores(true);
    nodeStore = neoStores.getNodeStore();
}
Also used : DefaultIdGeneratorFactory(org.neo4j.kernel.impl.store.id.DefaultIdGeneratorFactory) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) File(java.io.File) Before(org.junit.Before)

Aggregations

StoreFactory (org.neo4j.kernel.impl.store.StoreFactory)64 NeoStores (org.neo4j.kernel.impl.store.NeoStores)31 DefaultIdGeneratorFactory (org.neo4j.internal.id.DefaultIdGeneratorFactory)30 File (java.io.File)18 BeforeEach (org.junit.jupiter.api.BeforeEach)15 PageCache (org.neo4j.io.pagecache.PageCache)12 DefaultIdGeneratorFactory (org.neo4j.kernel.impl.store.id.DefaultIdGeneratorFactory)11 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)7 MethodSource (org.junit.jupiter.params.provider.MethodSource)7 IOException (java.io.IOException)6 Path (java.nio.file.Path)6 Before (org.junit.Before)6 Test (org.junit.Test)6 Config (org.neo4j.configuration.Config)6 DefaultFileSystemAbstraction (org.neo4j.io.fs.DefaultFileSystemAbstraction)6 CursorContext (org.neo4j.io.pagecache.context.CursorContext)6 Config (org.neo4j.kernel.configuration.Config)6 LogProvider (org.neo4j.logging.LogProvider)6 NullLogProvider (org.neo4j.logging.NullLogProvider)6 ScanOnOpenOverwritingIdGeneratorFactory (org.neo4j.internal.id.ScanOnOpenOverwritingIdGeneratorFactory)5