Search in sources :

Example 1 with OperationalMode

use of org.neo4j.kernel.impl.factory.OperationalMode in project neo4j by neo4j.

the class GraphStoreFixture method directStoreAccess.

public DirectStoreAccess directStoreAccess() {
    if (directStoreAccess == null) {
        fileSystem = new DefaultFileSystemAbstraction();
        PageCache pageCache = getPageCache(fileSystem);
        LogProvider logProvider = NullLogProvider.getInstance();
        StoreFactory storeFactory = new StoreFactory(directory, pageCache, fileSystem, logProvider);
        neoStore = storeFactory.openAllNeoStores();
        StoreAccess nativeStores;
        if (keepStatistics) {
            AccessStatistics accessStatistics = new AccessStatistics();
            statistics = new VerboseStatistics(accessStatistics, new DefaultCounts(defaultConsistencyCheckThreadsNumber()), NullLog.getInstance());
            nativeStores = new AccessStatsKeepingStoreAccess(neoStore, accessStatistics);
        } else {
            statistics = Statistics.NONE;
            nativeStores = new StoreAccess(neoStore);
        }
        nativeStores.initialize();
        Config config = Config.empty();
        OperationalMode operationalMode = OperationalMode.single;
        IndexStoreView indexStoreView = new NeoStoreIndexStoreView(LockService.NO_LOCK_SERVICE, nativeStores.getRawNeoStores());
        Dependencies dependencies = new Dependencies();
        dependencies.satisfyDependencies(Config.defaults(), fileSystem, new SimpleLogService(logProvider, logProvider), indexStoreView, pageCache);
        KernelContext kernelContext = new SimpleKernelContext(directory, UNKNOWN, dependencies);
        LabelScanStore labelScanStore = startLabelScanStore(config, dependencies, kernelContext);
        directStoreAccess = new DirectStoreAccess(nativeStores, labelScanStore, createIndexes(fileSystem, config, operationalMode));
    }
    return directStoreAccess;
}
Also used : LabelScanStore(org.neo4j.kernel.api.labelscan.LabelScanStore) DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) AccessStatsKeepingStoreAccess(org.neo4j.consistency.statistics.AccessStatsKeepingStoreAccess) DirectStoreAccess(org.neo4j.kernel.api.direct.DirectStoreAccess) StoreAccess(org.neo4j.kernel.impl.store.StoreAccess) SimpleLogService(org.neo4j.kernel.impl.logging.SimpleLogService) Config(org.neo4j.kernel.configuration.Config) DirectStoreAccess(org.neo4j.kernel.api.direct.DirectStoreAccess) AccessStatsKeepingStoreAccess(org.neo4j.consistency.statistics.AccessStatsKeepingStoreAccess) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) OperationalMode(org.neo4j.kernel.impl.factory.OperationalMode) NullLogProvider(org.neo4j.logging.NullLogProvider) FormattedLogProvider(org.neo4j.logging.FormattedLogProvider) LogProvider(org.neo4j.logging.LogProvider) NeoStoreIndexStoreView(org.neo4j.kernel.impl.transaction.state.storeview.NeoStoreIndexStoreView) DefaultCounts(org.neo4j.consistency.statistics.DefaultCounts) AccessStatistics(org.neo4j.consistency.statistics.AccessStatistics) IndexStoreView(org.neo4j.kernel.impl.api.index.IndexStoreView) NeoStoreIndexStoreView(org.neo4j.kernel.impl.transaction.state.storeview.NeoStoreIndexStoreView) SimpleKernelContext(org.neo4j.kernel.impl.spi.SimpleKernelContext) VerboseStatistics(org.neo4j.consistency.statistics.VerboseStatistics) Dependencies(org.neo4j.kernel.impl.util.Dependencies) PageCache(org.neo4j.io.pagecache.PageCache) SimpleKernelContext(org.neo4j.kernel.impl.spi.SimpleKernelContext) KernelContext(org.neo4j.kernel.impl.spi.KernelContext)

Example 2 with OperationalMode

use of org.neo4j.kernel.impl.factory.OperationalMode in project neo4j by neo4j.

the class Neo4jMetricsBuilder method build.

public boolean build() {
    boolean result = false;
    if (config.get(MetricsSettings.neoTxEnabled)) {
        life.add(new TransactionMetrics(registry, dependencies.transactionIdStore(), dependencies.transactionCounters()));
        result = true;
    }
    if (config.get(MetricsSettings.neoPageCacheEnabled)) {
        life.add(new PageCacheMetrics(registry, dependencies.pageCacheCounters()));
        result = true;
    }
    if (config.get(MetricsSettings.neoCheckPointingEnabled)) {
        life.add(new CheckPointingMetrics(reporter, registry, dependencies.monitors(), dependencies.checkPointerMonitor()));
        result = true;
    }
    if (config.get(MetricsSettings.neoLogRotationEnabled)) {
        life.add(new LogRotationMetrics(reporter, registry, dependencies.monitors(), dependencies.logRotationMonitor()));
        result = true;
    }
    if (config.get(MetricsSettings.neoCountsEnabled)) {
        life.add(new EntityCountMetrics(registry, dependencies.entityCountStats()));
        result = true;
    }
    if (config.get(MetricsSettings.neoNetworkEnabled)) {
        life.add(new NetworkMetrics(registry, dependencies.monitors()));
        result = true;
    }
    if (config.get(MetricsSettings.neoClusterEnabled)) {
        if (kernelContext.databaseInfo().operationalMode == OperationalMode.ha) {
            life.add(new ClusterMetrics(dependencies.monitors(), registry, dependencies.clusterMembers()));
            result = true;
        } else {
            logService.getUserLog(getClass()).warn("Cluster metrics was enabled but the graph database is not in HA mode.");
        }
    }
    if (config.get(MetricsSettings.cypherPlanningEnabled)) {
        life.add(new CypherMetrics(registry, dependencies.monitors()));
        result = true;
    }
    if (config.get(MetricsSettings.jvmGcEnabled)) {
        life.add(new GCMetrics(registry));
        result = true;
    }
    if (config.get(MetricsSettings.jvmThreadsEnabled)) {
        life.add(new ThreadMetrics(registry));
        result = true;
    }
    if (config.get(MetricsSettings.boltMessagesEnabled)) {
        life.add(new BoltMetrics(registry, dependencies.monitors()));
        result = true;
    }
    if (config.get(MetricsSettings.jvmMemoryEnabled)) {
        life.add(new MemoryPoolMetrics(registry));
        result = true;
    }
    if (config.get(MetricsSettings.jvmBuffersEnabled)) {
        life.add(new MemoryBuffersMetrics(registry));
        result = true;
    }
    if (config.get(MetricsSettings.causalClusteringEnabled)) {
        OperationalMode mode = kernelContext.databaseInfo().operationalMode;
        if (mode == OperationalMode.core) {
            life.add(new CoreMetrics(dependencies.monitors(), registry, dependencies.raft()));
            life.add(new CatchUpMetrics(dependencies.monitors(), registry));
            result = true;
        } else if (mode == OperationalMode.read_replica) {
            life.add(new ReadReplicaMetrics(dependencies.monitors(), registry));
            life.add(new CatchUpMetrics(dependencies.monitors(), registry));
            result = true;
        } else {
            logService.getUserLog(getClass()).warn("Causal Clustering metrics was enabled but the graph database is not in Causal " + "Clustering mode.");
        }
    }
    if (config.get(MetricsSettings.neoServerEnabled)) {
        life.add(new ServerMetrics(registry, logService, kernelContext.dependencySatisfier()));
        result = true;
    }
    return result;
}
Also used : ReadReplicaMetrics(org.neo4j.metrics.source.causalclustering.ReadReplicaMetrics) CheckPointingMetrics(org.neo4j.metrics.source.db.CheckPointingMetrics) NetworkMetrics(org.neo4j.metrics.source.cluster.NetworkMetrics) MemoryBuffersMetrics(org.neo4j.metrics.source.jvm.MemoryBuffersMetrics) LogRotationMetrics(org.neo4j.metrics.source.db.LogRotationMetrics) BoltMetrics(org.neo4j.metrics.source.db.BoltMetrics) CatchUpMetrics(org.neo4j.metrics.source.causalclustering.CatchUpMetrics) TransactionMetrics(org.neo4j.metrics.source.db.TransactionMetrics) OperationalMode(org.neo4j.kernel.impl.factory.OperationalMode) CoreMetrics(org.neo4j.metrics.source.causalclustering.CoreMetrics) MemoryPoolMetrics(org.neo4j.metrics.source.jvm.MemoryPoolMetrics) ClusterMetrics(org.neo4j.metrics.source.cluster.ClusterMetrics) CypherMetrics(org.neo4j.metrics.source.db.CypherMetrics) ThreadMetrics(org.neo4j.metrics.source.jvm.ThreadMetrics) PageCacheMetrics(org.neo4j.metrics.source.db.PageCacheMetrics) EntityCountMetrics(org.neo4j.metrics.source.db.EntityCountMetrics) ServerMetrics(org.neo4j.metrics.source.server.ServerMetrics) GCMetrics(org.neo4j.metrics.source.jvm.GCMetrics)

Example 3 with OperationalMode

use of org.neo4j.kernel.impl.factory.OperationalMode in project neo4j by neo4j.

the class LuceneSchemaIndexProviderCompatibilitySuiteTest method createIndexProvider.

@Override
protected LuceneSchemaIndexProvider createIndexProvider(FileSystemAbstraction fs, File graphDbDir) {
    DirectoryFactory.InMemoryDirectoryFactory directoryFactory = new DirectoryFactory.InMemoryDirectoryFactory();
    NullLogProvider logging = NullLogProvider.getInstance();
    Config config = Config.defaults();
    OperationalMode mode = OperationalMode.single;
    return new LuceneSchemaIndexProvider(fs, directoryFactory, graphDbDir, logging, config, mode);
}
Also used : Config(org.neo4j.kernel.configuration.Config) DirectoryFactory(org.neo4j.kernel.api.impl.index.storage.DirectoryFactory) NullLogProvider(org.neo4j.logging.NullLogProvider) OperationalMode(org.neo4j.kernel.impl.factory.OperationalMode)

Aggregations

OperationalMode (org.neo4j.kernel.impl.factory.OperationalMode)3 Config (org.neo4j.kernel.configuration.Config)2 NullLogProvider (org.neo4j.logging.NullLogProvider)2 AccessStatistics (org.neo4j.consistency.statistics.AccessStatistics)1 AccessStatsKeepingStoreAccess (org.neo4j.consistency.statistics.AccessStatsKeepingStoreAccess)1 DefaultCounts (org.neo4j.consistency.statistics.DefaultCounts)1 VerboseStatistics (org.neo4j.consistency.statistics.VerboseStatistics)1 DefaultFileSystemAbstraction (org.neo4j.io.fs.DefaultFileSystemAbstraction)1 PageCache (org.neo4j.io.pagecache.PageCache)1 DirectStoreAccess (org.neo4j.kernel.api.direct.DirectStoreAccess)1 DirectoryFactory (org.neo4j.kernel.api.impl.index.storage.DirectoryFactory)1 LabelScanStore (org.neo4j.kernel.api.labelscan.LabelScanStore)1 IndexStoreView (org.neo4j.kernel.impl.api.index.IndexStoreView)1 SimpleLogService (org.neo4j.kernel.impl.logging.SimpleLogService)1 KernelContext (org.neo4j.kernel.impl.spi.KernelContext)1 SimpleKernelContext (org.neo4j.kernel.impl.spi.SimpleKernelContext)1 StoreAccess (org.neo4j.kernel.impl.store.StoreAccess)1 StoreFactory (org.neo4j.kernel.impl.store.StoreFactory)1 NeoStoreIndexStoreView (org.neo4j.kernel.impl.transaction.state.storeview.NeoStoreIndexStoreView)1 Dependencies (org.neo4j.kernel.impl.util.Dependencies)1