Search in sources :

Example 1 with Monitors

use of org.neo4j.monitoring.Monitors in project neo4j by neo4j.

the class FusionIndexProvider30CompatibilitySuiteTest method createIndexProvider.

@Override
protected IndexProvider createIndexProvider(PageCache pageCache, FileSystemAbstraction fs, Path graphDbDir, Config config) {
    Monitors monitors = new Monitors();
    String monitorTag = "";
    RecoveryCleanupWorkCollector recoveryCleanupWorkCollector = RecoveryCleanupWorkCollector.immediate();
    var readOnlyChecker = new DatabaseReadOnlyChecker.Default(config, DEFAULT_DATABASE_NAME);
    return NativeLuceneFusionIndexProviderFactory30.create(pageCache, graphDbDir, fs, monitors, monitorTag, config, readOnlyChecker, recoveryCleanupWorkCollector, PageCacheTracer.NULL, DEFAULT_DATABASE_NAME);
}
Also used : Monitors(org.neo4j.monitoring.Monitors) RecoveryCleanupWorkCollector(org.neo4j.index.internal.gbptree.RecoveryCleanupWorkCollector)

Example 2 with Monitors

use of org.neo4j.monitoring.Monitors 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 Monitors

use of org.neo4j.monitoring.Monitors in project neo4j by neo4j.

the class BoltStateMachineFactoryImplTest method newBoltFactory.

private static BoltStateMachineFactoryImpl newBoltFactory(DatabaseManagementService managementService) {
    var config = Config.defaults(GraphDatabaseSettings.default_database, CUSTOM_DB_NAME);
    var dbProvider = new BoltKernelDatabaseManagementServiceProvider(managementService, new Monitors(), CLOCK, Duration.ZERO);
    return new BoltStateMachineFactoryImpl(dbProvider, mock(Authentication.class), CLOCK, config, NullLogService.getInstance(), mock(DefaultDatabaseResolver.class));
}
Also used : BoltKernelDatabaseManagementServiceProvider(org.neo4j.bolt.dbapi.impl.BoltKernelDatabaseManagementServiceProvider) Authentication(org.neo4j.bolt.security.auth.Authentication) DefaultDatabaseResolver(org.neo4j.kernel.database.DefaultDatabaseResolver) Monitors(org.neo4j.monitoring.Monitors)

Example 4 with Monitors

use of org.neo4j.monitoring.Monitors in project neo4j by neo4j.

the class DefaultDatabaseTransactionStateMachineSPIProviderTest method newSpiProvider.

private TransactionStateMachineSPIProvider newSpiProvider(DatabaseManagementService managementService) {
    var clock = mock(SystemNanoClock.class);
    var dbProvider = new BoltKernelDatabaseManagementServiceProvider(managementService, new Monitors(), clock, Duration.ZERO);
    return new AbstractTransactionStatementSPIProvider(dbProvider, mockBoltChannel, clock, mock(MemoryTracker.class, RETURNS_MOCKS)) {

        @Override
        protected TransactionStateMachineSPI newTransactionStateMachineSPI(BoltGraphDatabaseServiceSPI activeBoltGraphDatabaseServiceSPI, StatementProcessorReleaseManager resourceReleaseManger) {
            return mock(TransactionStateMachineSPI.class);
        }

        @Override
        public void releaseTransactionStateMachineSPI() {
        }
    };
}
Also used : StatementProcessorReleaseManager(org.neo4j.bolt.runtime.statemachine.StatementProcessorReleaseManager) BoltKernelDatabaseManagementServiceProvider(org.neo4j.bolt.dbapi.impl.BoltKernelDatabaseManagementServiceProvider) Monitors(org.neo4j.monitoring.Monitors) BoltGraphDatabaseServiceSPI(org.neo4j.bolt.dbapi.BoltGraphDatabaseServiceSPI) MemoryTracker(org.neo4j.memory.MemoryTracker)

Example 5 with Monitors

use of org.neo4j.monitoring.Monitors in project neo4j by neo4j.

the class DatabaseServiceBookmarkTest method createDbSpi.

private BoltGraphDatabaseServiceSPI createDbSpi(TransactionIdStore txIdStore, Duration txAwaitDuration, DatabaseAvailabilityGuard availabilityGuard, SystemNanoClock clock) {
    var queryExecutionEngine = mock(QueryExecutionEngine.class);
    var db = mock(Database.class);
    when(db.getNamedDatabaseId()).thenReturn(DATABASE_ID);
    when(db.getDatabaseAvailabilityGuard()).thenReturn(availabilityGuard);
    var dependencyResolver = mock(Dependencies.class);
    when(dependencyResolver.resolveDependency(QueryExecutionEngine.class)).thenReturn(queryExecutionEngine);
    when(dependencyResolver.resolveDependency(DatabaseAvailabilityGuard.class)).thenReturn(availabilityGuard);
    when(dependencyResolver.resolveDependency(TransactionIdStore.class)).thenReturn(txIdStore);
    when(dependencyResolver.resolveDependency(Database.class)).thenReturn(db);
    when(db.getDependencyResolver()).thenReturn(dependencyResolver);
    var facade = mock(GraphDatabaseAPI.class);
    when(facade.getDependencyResolver()).thenReturn(dependencyResolver);
    var tx = mock(InternalTransaction.class);
    when(facade.beginTransaction(any(), any(), any())).thenReturn(tx);
    var queryService = mock(GraphDatabaseQueryService.class);
    when(queryService.getDependencyResolver()).thenReturn(dependencyResolver);
    when(dependencyResolver.resolveDependency(GraphDatabaseQueryService.class)).thenReturn(queryService);
    var managementService = mock(DatabaseManagementService.class);
    when(managementService.database(DATABASE_ID.name())).thenReturn(facade);
    var transactionIdTracker = new TransactionIdTracker(managementService, new Monitors(), clock);
    return new BoltKernelGraphDatabaseServiceProvider(facade, transactionIdTracker, txAwaitDuration, mock(MemoryTracker.class, RETURNS_MOCKS));
}
Also used : BoltKernelGraphDatabaseServiceProvider(org.neo4j.bolt.dbapi.impl.BoltKernelGraphDatabaseServiceProvider) Monitors(org.neo4j.monitoring.Monitors) TransactionIdTracker(org.neo4j.bolt.txtracking.TransactionIdTracker) MemoryTracker(org.neo4j.memory.MemoryTracker)

Aggregations

Monitors (org.neo4j.monitoring.Monitors)45 Test (org.junit.jupiter.api.Test)13 Path (java.nio.file.Path)7 Config (org.neo4j.configuration.Config)7 RecoveryCleanupWorkCollector (org.neo4j.index.internal.gbptree.RecoveryCleanupWorkCollector)7 Dependencies (org.neo4j.collection.Dependencies)6 IndexingService (org.neo4j.kernel.impl.api.index.IndexingService)6 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)5 DatabaseManagementService (org.neo4j.dbms.api.DatabaseManagementService)5 DatabaseLayout (org.neo4j.io.layout.DatabaseLayout)5 LifeSupport (org.neo4j.kernel.lifecycle.LifeSupport)5 TestDatabaseManagementServiceBuilder (org.neo4j.test.TestDatabaseManagementServiceBuilder)5 BoltKernelDatabaseManagementServiceProvider (org.neo4j.bolt.dbapi.impl.BoltKernelDatabaseManagementServiceProvider)4 DatabaseReadOnlyChecker (org.neo4j.configuration.helpers.DatabaseReadOnlyChecker)4 DefaultIdGeneratorFactory (org.neo4j.internal.id.DefaultIdGeneratorFactory)4 Log (org.neo4j.logging.Log)4 MemoryTracker (org.neo4j.memory.MemoryTracker)4 IOException (java.io.IOException)3 BeforeEach (org.junit.jupiter.api.BeforeEach)3 GraphDatabaseService (org.neo4j.graphdb.GraphDatabaseService)3