use of org.neo4j.kernel.impl.pagecache.ConfiguringPageCacheFactory in project neo4j by neo4j.
the class PlatformModule method createPageCache.
protected PageCache createPageCache(FileSystemAbstraction fileSystem, Config config, LogService logging, Tracers tracers) {
Log pageCacheLog = logging.getInternalLog(PageCache.class);
ConfiguringPageCacheFactory pageCacheFactory = new ConfiguringPageCacheFactory(fileSystem, config, tracers.pageCacheTracer, tracers.pageCursorTracerSupplier, pageCacheLog);
PageCache pageCache = pageCacheFactory.getOrCreatePageCache();
if (config.get(GraphDatabaseSettings.dump_configuration)) {
pageCacheFactory.dumpConfiguration();
}
return pageCache;
}
use of org.neo4j.kernel.impl.pagecache.ConfiguringPageCacheFactory in project neo4j by neo4j.
the class ConfigurablePageCacheRule method createPageCache.
private PageCache createPageCache(FileSystemAbstraction fs, PageCacheConfig pageCacheConfig, Config config) {
PageCacheTracer tracer = selectConfig(baseConfig.tracer, pageCacheConfig.tracer, PageCacheTracer.NULL);
PageCursorTracerSupplier cursorTracerSupplier = selectConfig(baseConfig.pageCursorTracerSupplier, pageCacheConfig.pageCursorTracerSupplier, DefaultPageCursorTracerSupplier.INSTANCE);
Config finalConfig = config.withDefaults(MapUtil.stringMap(GraphDatabaseSettings.pagecache_memory.name(), "8M"));
FormattedLogProvider logProvider = FormattedLogProvider.toOutputStream(System.err);
ConfiguringPageCacheFactory pageCacheFactory = new ConfiguringPageCacheFactory(fs, finalConfig, tracer, cursorTracerSupplier, logProvider.getLog(PageCache.class)) {
@Override
public int calculatePageSize(Config config, PageSwapperFactory swapperFactory) {
if (pageCacheConfig.pageSize != null) {
return pageCacheConfig.pageSize;
}
return super.calculatePageSize(config, swapperFactory);
}
};
return pageCacheFactory.getOrCreatePageCache();
}
use of org.neo4j.kernel.impl.pagecache.ConfiguringPageCacheFactory in project neo4j by neo4j.
the class NeoStoresRule method getOrCreatePageCache.
private static PageCache getOrCreatePageCache(Config config, FileSystemAbstraction fs) {
Log log = NullLog.getInstance();
ConfiguringPageCacheFactory pageCacheFactory = new ConfiguringPageCacheFactory(fs, config, NULL, PageCursorTracerSupplier.NULL, log);
return pageCacheFactory.getOrCreatePageCache();
}
use of org.neo4j.kernel.impl.pagecache.ConfiguringPageCacheFactory in project neo4j by neo4j.
the class BatchingNeoStoresTest method someDataInTheDatabase.
private void someDataInTheDatabase(Config config) throws Exception {
NullLog nullLog = NullLog.getInstance();
try (JobScheduler scheduler = JobSchedulerFactory.createInitialisedScheduler();
PageCache pageCache = new ConfiguringPageCacheFactory(fileSystem, Config.defaults(), PageCacheTracer.NULL, nullLog, scheduler, Clocks.nanoClock(), new MemoryPools()).getOrCreatePageCache();
Lifespan life = new Lifespan()) {
// TODO this little dance with TokenHolders is really annoying and must be solved with a better abstraction
DeferredInitializedTokenCreator propertyKeyTokenCreator = new DeferredInitializedTokenCreator() {
@Override
void create(String name, boolean internal, int id) {
txState.propertyKeyDoCreateForName(name, internal, id);
}
};
DeferredInitializedTokenCreator labelTokenCreator = new DeferredInitializedTokenCreator() {
@Override
void create(String name, boolean internal, int id) {
txState.labelDoCreateForName(name, internal, id);
}
};
DeferredInitializedTokenCreator relationshipTypeTokenCreator = new DeferredInitializedTokenCreator() {
@Override
void create(String name, boolean internal, int id) {
txState.relationshipTypeDoCreateForName(name, internal, id);
}
};
TokenHolders tokenHolders = new TokenHolders(new DelegatingTokenHolder(propertyKeyTokenCreator, TokenHolder.TYPE_PROPERTY_KEY), new DelegatingTokenHolder(labelTokenCreator, TokenHolder.TYPE_LABEL), new DelegatingTokenHolder(relationshipTypeTokenCreator, TokenHolder.TYPE_RELATIONSHIP_TYPE));
IndexConfigCompleter indexConfigCompleter = index -> index;
RecoveryCleanupWorkCollector recoveryCleanupWorkCollector = immediate();
RecordStorageEngine storageEngine = life.add(new RecordStorageEngine(databaseLayout, Config.defaults(), pageCache, fileSystem, NullLogProvider.getInstance(), tokenHolders, new DatabaseSchemaState(NullLogProvider.getInstance()), new StandardConstraintSemantics(), indexConfigCompleter, LockService.NO_LOCK_SERVICE, new DatabaseHealth(PanicEventGenerator.NO_OP, nullLog), new DefaultIdGeneratorFactory(fileSystem, immediate(), DEFAULT_DATABASE_NAME), new DefaultIdController(), recoveryCleanupWorkCollector, PageCacheTracer.NULL, true, INSTANCE, writable(), CommandLockVerification.Factory.IGNORE, LockVerificationMonitor.Factory.IGNORE));
// Create the relationship type token
TxState txState = new TxState();
NeoStores neoStores = storageEngine.testAccessNeoStores();
CommandCreationContext commandCreationContext = storageEngine.newCommandCreationContext(INSTANCE);
commandCreationContext.initialize(NULL);
propertyKeyTokenCreator.initialize(neoStores.getPropertyKeyTokenStore(), txState);
labelTokenCreator.initialize(neoStores.getLabelTokenStore(), txState);
relationshipTypeTokenCreator.initialize(neoStores.getRelationshipTypeTokenStore(), txState);
int relTypeId = tokenHolders.relationshipTypeTokens().getOrCreateId(RELTYPE.name());
apply(txState, commandCreationContext, storageEngine);
// Finally, we're initialized and ready to create two nodes and a relationship
txState = new TxState();
long node1 = commandCreationContext.reserveNode();
long node2 = commandCreationContext.reserveNode();
txState.nodeDoCreate(node1);
txState.nodeDoCreate(node2);
txState.relationshipDoCreate(commandCreationContext.reserveRelationship(), relTypeId, node1, node2);
apply(txState, commandCreationContext, storageEngine);
neoStores.flush(NULL);
}
}
use of org.neo4j.kernel.impl.pagecache.ConfiguringPageCacheFactory in project neo4j by neo4j.
the class GlobalModule method createPageCache.
protected PageCache createPageCache(FileSystemAbstraction fileSystem, Config config, LogService logging, Tracers tracers, JobScheduler jobScheduler, SystemNanoClock clock, MemoryPools memoryPools) {
Log pageCacheLog = logging.getInternalLog(PageCache.class);
ConfiguringPageCacheFactory pageCacheFactory = new ConfiguringPageCacheFactory(fileSystem, config, tracers.getPageCacheTracer(), pageCacheLog, jobScheduler, clock, memoryPools);
PageCache pageCache = pageCacheFactory.getOrCreatePageCache();
if (config.get(GraphDatabaseInternalSettings.dump_configuration)) {
pageCacheFactory.dumpConfiguration();
}
return pageCache;
}
Aggregations