Search in sources :

Example 1 with Dependencies

use of org.neo4j.collection.Dependencies in project neo4j by neo4j.

the class BTreeIndexKeySizeValidationIT method startDb.

private void startDb(int pageSize) {
    TestDatabaseManagementServiceBuilder builder = new TestDatabaseManagementServiceBuilder(neo4jLayout);
    builder.setConfig(default_schema_provider, NATIVE_BTREE10.providerName());
    scheduler = JobSchedulerFactory.createInitialisedScheduler();
    PageCache pageCache = StandalonePageCacheFactory.createPageCache(fs, scheduler, pageSize);
    Dependencies dependencies = new Dependencies();
    dependencies.satisfyDependency(pageCache);
    builder.setExternalDependencies(dependencies);
    dbms = builder.build();
    db = (GraphDatabaseAPI) dbms.database(DEFAULT_DATABASE_NAME);
}
Also used : TestDatabaseManagementServiceBuilder(org.neo4j.test.TestDatabaseManagementServiceBuilder) Dependencies(org.neo4j.collection.Dependencies) PageCache(org.neo4j.io.pagecache.PageCache)

Example 2 with Dependencies

use of org.neo4j.collection.Dependencies in project neo4j by neo4j.

the class StoreUpgraderTest method newUpgrader.

private StoreUpgrader newUpgrader(StoreVersionCheck storeVersionCheck, PageCache pageCache, Config config, MigrationProgressMonitor progressMonitor, PageCacheTracer pageCacheTracer, boolean forceUpgrade) {
    NullLogService instance = NullLogService.getInstance();
    BatchImporterFactory batchImporterFactory = BatchImporterFactory.withHighestPriority();
    RecordStorageMigrator defaultMigrator = new RecordStorageMigrator(fileSystem, pageCache, getTuningConfig(), instance, jobScheduler, pageCacheTracer, batchImporterFactory, INSTANCE);
    StorageEngineFactory storageEngineFactory = StorageEngineFactory.defaultStorageEngine();
    SchemaIndexMigrator indexMigrator = new SchemaIndexMigrator("Indexes", fileSystem, pageCache, IndexProvider.EMPTY.directoryStructure(), storageEngineFactory, true);
    LegacyTransactionLogsLocator logsLocator = new LegacyTransactionLogsLocator(config, databaseLayout);
    DatabaseHealth databaseHealth = new DatabaseHealth(NO_OP, NullLog.getInstance());
    Dependencies dependencies = new Dependencies();
    dependencies.satisfyDependencies(new Monitors());
    LogsUpgrader logsUpgrader = new LogsUpgrader(fileSystem, storageEngineFactory, databaseLayout, pageCache, logsLocator, config, dependencies, pageCacheTracer, INSTANCE, databaseHealth, forceUpgrade);
    StoreUpgrader upgrader = new StoreUpgrader(storeVersionCheck, progressMonitor, config, fileSystem, NullLogProvider.getInstance(), logsUpgrader, pageCacheTracer);
    upgrader.addParticipant(indexMigrator);
    upgrader.addParticipant(NOT_PARTICIPATING);
    upgrader.addParticipant(NOT_PARTICIPATING);
    upgrader.addParticipant(NOT_PARTICIPATING);
    upgrader.addParticipant(NOT_PARTICIPATING);
    upgrader.addParticipant(defaultMigrator);
    return upgrader;
}
Also used : DatabaseHealth(org.neo4j.monitoring.DatabaseHealth) StorageEngineFactory(org.neo4j.storageengine.api.StorageEngineFactory) Monitors(org.neo4j.monitoring.Monitors) NullLogService(org.neo4j.logging.internal.NullLogService) BatchImporterFactory(org.neo4j.internal.batchimport.BatchImporterFactory) Dependencies(org.neo4j.collection.Dependencies) SchemaIndexMigrator(org.neo4j.storageengine.migration.SchemaIndexMigrator)

Example 3 with Dependencies

use of org.neo4j.collection.Dependencies in project neo4j by neo4j.

the class Database method init.

/**
 * Initialize the database, and bring it to a state where its version can be examined, and it can be
 * upgraded if necessary.
 */
@Override
public synchronized void init() {
    if (initialized) {
        return;
    }
    try {
        databaseDependencies = new Dependencies(globalDependencies);
        ioController = ioControllerService.createIOController(databaseConfig, clock);
        databasePageCache = new DatabasePageCache(globalPageCache, ioController);
        databaseMonitors = new Monitors(parentMonitors, internalLogProvider);
        life = new LifeSupport();
        life.add(new LockerLifecycleAdapter(fileLockerService.createDatabaseLocker(fs, databaseLayout)));
        life.add(databaseConfig);
        databaseHealth = databaseHealthFactory.newInstance();
        databaseAvailability = new DatabaseAvailability(databaseAvailabilityGuard, transactionStats, clock, getAwaitActiveTransactionDeadlineMillis());
        databaseDependencies.satisfyDependency(this);
        databaseDependencies.satisfyDependency(ioController);
        databaseDependencies.satisfyDependency(readOnlyDatabaseChecker);
        databaseDependencies.satisfyDependency(databaseLayout);
        databaseDependencies.satisfyDependency(startupController);
        databaseDependencies.satisfyDependency(databaseConfig);
        databaseDependencies.satisfyDependency(databaseMonitors);
        databaseDependencies.satisfyDependency(databaseLogService);
        databaseDependencies.satisfyDependency(databasePageCache);
        databaseDependencies.satisfyDependency(tokenHolders);
        databaseDependencies.satisfyDependency(databaseFacade);
        databaseDependencies.satisfyDependency(kernelTransactionFactory);
        databaseDependencies.satisfyDependency(databaseHealth);
        databaseDependencies.satisfyDependency(storeCopyCheckPointMutex);
        databaseDependencies.satisfyDependency(transactionStats);
        databaseDependencies.satisfyDependency(locks);
        databaseDependencies.satisfyDependency(databaseAvailabilityGuard);
        databaseDependencies.satisfyDependency(databaseAvailability);
        databaseDependencies.satisfyDependency(idGeneratorFactory);
        databaseDependencies.satisfyDependency(idController);
        databaseDependencies.satisfyDependency(lockService);
        databaseDependencies.satisfyDependency(versionContextSupplier);
        databaseDependencies.satisfyDependency(tracers.getDatabaseTracer());
        databaseDependencies.satisfyDependency(tracers.getPageCacheTracer());
        databaseDependencies.satisfyDependency(storageEngineFactory);
        recoveryCleanupWorkCollector = RecoveryCleanupWorkCollector.immediate();
        databaseDependencies.satisfyDependency(recoveryCleanupWorkCollector);
        life.add(new PageCacheLifecycle(databasePageCache));
        life.add(initializeExtensions(databaseDependencies));
        DatabaseLayoutWatcher watcherService = watcherServiceFactory.apply(databaseLayout);
        life.add(watcherService);
        databaseDependencies.satisfyDependency(watcherService);
        otherDatabasePool = otherMemoryPool.newDatabasePool(namedDatabaseId.name(), 0, null);
        life.add(onShutdown(() -> otherDatabasePool.close()));
        otherDatabaseMemoryTracker = otherDatabasePool.getPoolMemoryTracker();
        databaseDependencies.satisfyDependency(new DatabaseMemoryTrackers(otherDatabaseMemoryTracker));
        eventListeners.databaseCreate(namedDatabaseId);
        initialized = true;
    } catch (Throwable e) {
        handleStartupFailure(e);
    }
}
Also used : DatabaseLayoutWatcher(org.neo4j.io.fs.watcher.DatabaseLayoutWatcher) LockerLifecycleAdapter(org.neo4j.kernel.internal.locker.LockerLifecycleAdapter) Monitors(org.neo4j.monitoring.Monitors) LifeSupport(org.neo4j.kernel.lifecycle.LifeSupport) DatabaseAvailability(org.neo4j.kernel.availability.DatabaseAvailability) Dependencies(org.neo4j.collection.Dependencies) DatabasePageCache(org.neo4j.dbms.database.DatabasePageCache) PageCacheLifecycle(org.neo4j.kernel.impl.pagecache.PageCacheLifecycle)

Example 4 with Dependencies

use of org.neo4j.collection.Dependencies in project neo4j by neo4j.

the class QueryRestartIT method startSnapshotQueryDb.

private GraphDatabaseService startSnapshotQueryDb() {
    // Inject TransactionVersionContextSupplier
    Dependencies dependencies = new Dependencies();
    dependencies.satisfyDependencies(testContextSupplier);
    managementService = new TestDatabaseManagementServiceBuilder(storeDir).setExternalDependencies(dependencies).setConfig(snapshot_query, true).setConfig(index_background_sampling_enabled, false).build();
    return managementService.database(DEFAULT_DATABASE_NAME);
}
Also used : TestDatabaseManagementServiceBuilder(org.neo4j.test.TestDatabaseManagementServiceBuilder) Dependencies(org.neo4j.collection.Dependencies)

Example 5 with Dependencies

use of org.neo4j.collection.Dependencies in project neo4j by neo4j.

the class DbmsSupportController method startDatabase.

public void startDatabase(String databaseName) {
    if (!dbms.listDatabases().contains(databaseName)) {
        dbms.createDatabase(databaseName);
    }
    var db = (GraphDatabaseAPI) dbms.database(databaseName);
    var dependencyResolver = db.getDependencyResolver();
    injectDependencies(dependencyResolver);
    // Also inject DbmsController into the test.
    Dependencies deps = new Dependencies();
    deps.satisfyDependencies(asDbmsController());
    injectDependencies(deps);
}
Also used : GraphDatabaseAPI(org.neo4j.kernel.internal.GraphDatabaseAPI) Dependencies(org.neo4j.collection.Dependencies)

Aggregations

Dependencies (org.neo4j.collection.Dependencies)40 Test (org.junit.jupiter.api.Test)13 TestDatabaseManagementServiceBuilder (org.neo4j.test.TestDatabaseManagementServiceBuilder)7 Config (org.neo4j.configuration.Config)6 Monitors (org.neo4j.monitoring.Monitors)6 PageCache (org.neo4j.io.pagecache.PageCache)5 LifeSupport (org.neo4j.kernel.lifecycle.LifeSupport)5 DatabaseHealth (org.neo4j.monitoring.DatabaseHealth)5 StorageEngine (org.neo4j.storageengine.api.StorageEngine)5 BeforeEach (org.junit.jupiter.api.BeforeEach)4 DatabaseReadOnlyChecker (org.neo4j.configuration.helpers.DatabaseReadOnlyChecker)4 DatabaseManagementService (org.neo4j.dbms.api.DatabaseManagementService)4 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)4 Database (org.neo4j.kernel.database.Database)4 IndexingService (org.neo4j.kernel.impl.api.index.IndexingService)4 StorageEngineFactory (org.neo4j.storageengine.api.StorageEngineFactory)4 IOException (java.io.IOException)3 RecoveryCleanupWorkCollector (org.neo4j.index.internal.gbptree.RecoveryCleanupWorkCollector)3 GlobalExtensionContext (org.neo4j.kernel.extension.context.GlobalExtensionContext)3 IndexStatisticsStore (org.neo4j.kernel.impl.api.index.stats.IndexStatisticsStore)3