use of org.neo4j.monitoring.Monitors in project neo4j by neo4j.
the class BuiltInProceduresIT method replanMonitor.
private ReplanMonitor replanMonitor() {
Monitors monitors = dependencyResolver.resolveDependency(Monitors.class);
ReplanMonitor monitorListener = new ReplanMonitor();
monitors.addMonitorListener(monitorListener);
return monitorListener;
}
use of org.neo4j.monitoring.Monitors in project neo4j by neo4j.
the class AbstractIndexProviderFactory method newInstance.
@Override
public IndexProvider newInstance(ExtensionContext context, Dependencies dependencies) {
PageCache pageCache = dependencies.pageCache();
Path databaseDir = context.directory();
FileSystemAbstraction fs = dependencies.fileSystem();
Log log = dependencies.getLogService().getInternalLogProvider().getLog(loggingClass());
Monitors monitors = dependencies.monitors();
String monitorTag = descriptor().toString();
monitors.addMonitorListener(new LoggingMonitor(log), monitorTag);
Config config = dependencies.getConfig();
var readOnlyChecker = dependencies.readOnlyChecker();
if (OperationalMode.SINGLE != context.dbmsInfo().operationalMode) {
// if running as part of cluster indexes should be writable to allow catchup process to accept transactions
readOnlyChecker = DatabaseReadOnlyChecker.writable();
}
RecoveryCleanupWorkCollector recoveryCleanupWorkCollector = dependencies.recoveryCleanupWorkCollector();
PageCacheTracer pageCacheTracer = dependencies.pageCacheTracer();
DatabaseLayout databaseLayout = dependencies.databaseLayout();
return internalCreate(pageCache, databaseDir, fs, monitors, monitorTag, config, readOnlyChecker, recoveryCleanupWorkCollector, databaseLayout, pageCacheTracer);
}
use of org.neo4j.monitoring.Monitors in project neo4j by neo4j.
the class StartOldDbOnCurrentVersionAndCreateFusionIndexIT method setupDb.
private DatabaseManagementService setupDb(Path storeDir, IndexRecoveryTracker indexRecoveryTracker) {
Monitors monitors = new Monitors();
monitors.addMonitorListener(indexRecoveryTracker);
return new TestDatabaseManagementServiceBuilder(storeDir).setMonitors(monitors).setConfig(GraphDatabaseSettings.allow_upgrade, true).build();
}
use of org.neo4j.monitoring.Monitors in project neo4j by neo4j.
the class RecoverIndexDropIT method shouldDropIndexOnRecovery.
@Test
void shouldDropIndexOnRecovery() throws IOException {
// given a transaction stream ending in an INDEX DROP command.
CommittedTransactionRepresentation dropTransaction = prepareDropTransaction();
DatabaseManagementService managementService = configure(new TestDatabaseManagementServiceBuilder(databaseLayout)).build();
GraphDatabaseService db = managementService.database(DEFAULT_DATABASE_NAME);
long initialIndexCount = currentIndexCount(db);
createIndex(db);
StorageEngineFactory storageEngineFactory = ((GraphDatabaseAPI) db).getDependencyResolver().resolveDependency(StorageEngineFactory.class);
managementService.shutdown();
appendDropTransactionToTransactionLog(databaseLayout.getTransactionLogsDirectory(), dropTransaction, storageEngineFactory);
// when recovering this (the drop transaction with the index file intact)
Monitors monitors = new Monitors();
AssertRecoveryIsPerformed recoveryMonitor = new AssertRecoveryIsPerformed();
monitors.addMonitorListener(recoveryMonitor);
managementService = configure(new TestDatabaseManagementServiceBuilder(databaseLayout).setMonitors(monitors)).build();
db = managementService.database(DEFAULT_DATABASE_NAME);
try {
assertTrue(recoveryMonitor.recoveryWasRequired);
// then
assertEquals(initialIndexCount, currentIndexCount(db));
} finally {
// and the ability to shut down w/o failing on still open files
managementService.shutdown();
}
}
use of org.neo4j.monitoring.Monitors in project neo4j by neo4j.
the class SessionExtension method beforeEach.
@Override
public void beforeEach(ExtensionContext extensionContext) {
managementService = builderFactory.get().impermanent().setConfig(GraphDatabaseSettings.auth_enabled, authEnabled).build();
gdb = (GraphDatabaseAPI) managementService.database(GraphDatabaseSettings.DEFAULT_DATABASE_NAME);
DependencyResolver resolver = gdb.getDependencyResolver();
Authentication authentication = authentication(resolver.resolveDependency(AuthManager.class));
Config config = resolver.resolveDependency(Config.class);
SystemNanoClock clock = Clocks.nanoClock();
DefaultDatabaseResolver defaultDatabaseResolver = new CommunityDefaultDatabaseResolver(config, () -> managementService.database(GraphDatabaseSettings.SYSTEM_DATABASE_NAME));
BoltGraphDatabaseManagementServiceSPI databaseManagementService = new BoltKernelDatabaseManagementServiceProvider(managementService, new Monitors(), clock, ofSeconds(30));
boltFactory = new BoltStateMachineFactoryImpl(databaseManagementService, authentication, clock, config, NullLogService.getInstance(), defaultDatabaseResolver);
}
Aggregations