use of org.neo4j.kernel.impl.pagecache.ConfiguringPageCacheFactory in project neo4j by neo4j.
the class ConsistencyCheckServiceIntegrationTest method tracePageCacheAccessOnConsistencyCheck.
@Test
void tracePageCacheAccessOnConsistencyCheck() throws ConsistencyCheckIncompleteException {
prepareDbWithDeletedRelationshipPartOfTheChain();
ConsistencyCheckService service = new ConsistencyCheckService(new Date());
var pageCacheTracer = new DefaultPageCacheTracer();
fixture.close();
JobScheduler jobScheduler = JobSchedulerFactory.createScheduler();
ConfiguringPageCacheFactory pageCacheFactory = new ConfiguringPageCacheFactory(testDirectory.getFileSystem(), Config.defaults(GraphDatabaseSettings.pagecache_memory, "8m"), pageCacheTracer, NullLog.getInstance(), jobScheduler, Clocks.nanoClock(), new MemoryPools(false));
try (Lifespan life = new Lifespan(jobScheduler);
PageCache pageCache = pageCacheFactory.getOrCreatePageCache()) {
var result = service.runFullConsistencyCheck(fixture.databaseLayout(), Config.defaults(settings()), ProgressMonitorFactory.NONE, NullLogProvider.getInstance(), testDirectory.getFileSystem(), pageCache, false, ConsistencyFlags.DEFAULT, pageCacheTracer, INSTANCE);
assertFalse(result.isSuccessful());
assertThat(pageCacheTracer.pins()).isGreaterThanOrEqualTo(74);
assertThat(pageCacheTracer.unpins()).isGreaterThanOrEqualTo(74);
assertThat(pageCacheTracer.hits()).isGreaterThanOrEqualTo(35);
assertThat(pageCacheTracer.faults()).isGreaterThanOrEqualTo(39);
}
}
use of org.neo4j.kernel.impl.pagecache.ConfiguringPageCacheFactory in project neo4j by neo4j.
the class FullCheckFulltextIndexEmptyDocs method check.
private ConsistencyCheckService.Result check(Config config, DatabaseLayout layout) throws Exception {
JobScheduler jobScheduler = JobSchedulerFactory.createInitialisedScheduler();
ConfiguringPageCacheFactory pageCacheFactory = new ConfiguringPageCacheFactory(fs, config, NULL, NullLog.getInstance(), jobScheduler, Clocks.nanoClock(), new MemoryPools(config.get(memory_tracking)));
PageCache pageCache = pageCacheFactory.getOrCreatePageCache();
ConsistencyCheckService.Result result;
try {
result = new ConsistencyCheckService().runFullConsistencyCheck(layout, config, NONE, NullLogProvider.getInstance(), fs, pageCache, DebugContext.NO_DEBUG, layout.databaseDirectory(), DEFAULT, NULL, INSTANCE);
} finally {
pageCache.close();
jobScheduler.close();
}
return result;
}
use of org.neo4j.kernel.impl.pagecache.ConfiguringPageCacheFactory in project neo4j by neo4j.
the class ConsistencyCheckService method runFullConsistencyCheck.
public Result runFullConsistencyCheck(File storeDir, Config config, ProgressMonitorFactory progressFactory, LogProvider logProvider, FileSystemAbstraction fileSystem, boolean verbose, File reportDir, CheckConsistencyConfig checkConsistencyConfig) throws ConsistencyCheckIncompleteException, IOException {
Log log = logProvider.getLog(getClass());
ConfiguringPageCacheFactory pageCacheFactory = new ConfiguringPageCacheFactory(fileSystem, config, PageCacheTracer.NULL, PageCursorTracerSupplier.NULL, logProvider.getLog(PageCache.class));
PageCache pageCache = pageCacheFactory.getOrCreatePageCache();
try {
return runFullConsistencyCheck(storeDir, config, progressFactory, logProvider, fileSystem, pageCache, verbose, reportDir, checkConsistencyConfig);
} finally {
try {
pageCache.close();
} catch (Exception e) {
log.error("Failure during shutdown of the page cache", e);
}
}
}
use of org.neo4j.kernel.impl.pagecache.ConfiguringPageCacheFactory in project neo4j by neo4j.
the class StoreMigratorTest method shouldNotDoActualStoreMigrationBetween3_0_5_and_next.
@Test
public void shouldNotDoActualStoreMigrationBetween3_0_5_and_next() throws Exception {
// GIVEN a store in vE.H.0 format
File storeDir = directory.directory();
new TestGraphDatabaseFactory().newEmbeddedDatabaseBuilder(storeDir).setConfig(GraphDatabaseSettings.record_format, HighLimitV3_0_0.NAME).newGraphDatabase().shutdown();
Config config = Config.embeddedDefaults(stringMap(pagecache_memory.name(), "8m"));
try (FileSystemAbstraction fs = new DefaultFileSystemAbstraction();
PageCache pageCache = new ConfiguringPageCacheFactory(fs, config, NULL, PageCursorTracerSupplier.NULL, NullLog.getInstance()).getOrCreatePageCache()) {
// For test code sanity
String fromStoreVersion = StoreVersion.HIGH_LIMIT_V3_0_0.versionString();
Result hasVersionResult = new StoreVersionCheck(pageCache).hasVersion(new File(storeDir, NEO_STORE.fileName(STORE)), fromStoreVersion);
assertTrue(hasVersionResult.actualVersion, hasVersionResult.outcome.isSuccessful());
// WHEN
StoreMigrator migrator = new StoreMigrator(fs, pageCache, config, NullLogService.getInstance(), NO_INDEX_PROVIDER);
MigrationProgressMonitor.Section monitor = mock(MigrationProgressMonitor.Section.class);
File migrationDir = new File(storeDir, "migration");
fs.mkdirs(migrationDir);
migrator.migrate(storeDir, migrationDir, monitor, fromStoreVersion, StoreVersion.HIGH_LIMIT_V3_0_6.versionString());
// THEN
verifyNoMoreInteractions(monitor);
}
}
use of org.neo4j.kernel.impl.pagecache.ConfiguringPageCacheFactory in project neo4j by neo4j.
the class StoreNodeRelationshipCursorTest method setupStores.
@BeforeClass
public static void setupStores() {
File storeDir = directory.absolutePath();
fs = new DefaultFileSystemAbstraction();
pageCache = new ConfiguringPageCacheFactory(fs, Config.defaults().augment(stringMap(pagecache_memory.name(), "8m")), NULL, PageCursorTracerSupplier.NULL, NullLog.getInstance()).getOrCreatePageCache();
StoreFactory storeFactory = new StoreFactory(storeDir, pageCache, fs, NullLogProvider.getInstance());
neoStores = storeFactory.openAllNeoStores(true);
}
Aggregations