Search in sources :

Example 6 with ConfiguringPageCacheFactory

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);
    }
}
Also used : JobScheduler(org.neo4j.scheduler.JobScheduler) MemoryPools(org.neo4j.memory.MemoryPools) ConfiguringPageCacheFactory(org.neo4j.kernel.impl.pagecache.ConfiguringPageCacheFactory) Lifespan(org.neo4j.kernel.lifecycle.Lifespan) Date(java.util.Date) PageCache(org.neo4j.io.pagecache.PageCache) DefaultPageCacheTracer(org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer) Test(org.junit.jupiter.api.Test)

Example 7 with ConfiguringPageCacheFactory

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;
}
Also used : JobScheduler(org.neo4j.scheduler.JobScheduler) MemoryPools(org.neo4j.memory.MemoryPools) ConsistencyCheckService(org.neo4j.consistency.ConsistencyCheckService) ConfiguringPageCacheFactory(org.neo4j.kernel.impl.pagecache.ConfiguringPageCacheFactory) PageCache(org.neo4j.io.pagecache.PageCache)

Example 8 with ConfiguringPageCacheFactory

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);
        }
    }
}
Also used : Log(org.neo4j.logging.Log) DuplicatingLog(org.neo4j.logging.DuplicatingLog) ConfiguringPageCacheFactory(org.neo4j.kernel.impl.pagecache.ConfiguringPageCacheFactory) PageCache(org.neo4j.io.pagecache.PageCache) IOException(java.io.IOException) ConsistencyCheckIncompleteException(org.neo4j.consistency.checking.full.ConsistencyCheckIncompleteException)

Example 9 with ConfiguringPageCacheFactory

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);
    }
}
Also used : DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) FileSystemAbstraction(org.neo4j.io.fs.FileSystemAbstraction) DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) Config(org.neo4j.kernel.configuration.Config) ConfiguringPageCacheFactory(org.neo4j.kernel.impl.pagecache.ConfiguringPageCacheFactory) Result(org.neo4j.kernel.impl.storemigration.StoreVersionCheck.Result) StoreVersionCheck(org.neo4j.kernel.impl.storemigration.StoreVersionCheck) MigrationProgressMonitor(org.neo4j.kernel.impl.storemigration.monitoring.MigrationProgressMonitor) TestGraphDatabaseFactory(org.neo4j.test.TestGraphDatabaseFactory) File(java.io.File) PageCache(org.neo4j.io.pagecache.PageCache) Test(org.junit.Test)

Example 10 with ConfiguringPageCacheFactory

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);
}
Also used : DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) ConfiguringPageCacheFactory(org.neo4j.kernel.impl.pagecache.ConfiguringPageCacheFactory) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) File(java.io.File) BeforeClass(org.junit.BeforeClass)

Aggregations

ConfiguringPageCacheFactory (org.neo4j.kernel.impl.pagecache.ConfiguringPageCacheFactory)12 PageCache (org.neo4j.io.pagecache.PageCache)10 Log (org.neo4j.logging.Log)5 MemoryPools (org.neo4j.memory.MemoryPools)5 JobScheduler (org.neo4j.scheduler.JobScheduler)5 IOException (java.io.IOException)3 Test (org.junit.jupiter.api.Test)3 File (java.io.File)2 Config (org.neo4j.configuration.Config)2 ConsistencyCheckService (org.neo4j.consistency.ConsistencyCheckService)2 ConsistencyCheckIncompleteException (org.neo4j.consistency.checking.full.ConsistencyCheckIncompleteException)2 DefaultFileSystemAbstraction (org.neo4j.io.fs.DefaultFileSystemAbstraction)2 PageCacheTracer (org.neo4j.io.pagecache.tracing.PageCacheTracer)2 Lifespan (org.neo4j.kernel.lifecycle.Lifespan)2 DuplicatingLog (org.neo4j.logging.DuplicatingLog)2 NullLog (org.neo4j.logging.NullLog)2 DirectoryNotEmptyException (java.nio.file.DirectoryNotEmptyException)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 List (java.util.List)1