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;
}
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;
}
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);
}
Aggregations