Search in sources :

Example 11 with ConfiguringPageCacheFactory

use of org.neo4j.kernel.impl.pagecache.ConfiguringPageCacheFactory in project neo4j by neo4j.

the class IndexCheckingSelectorTest method checkIndexesWithoutValuesWithNodeChecker.

@Test
void checkIndexesWithoutValuesWithNodeChecker() throws Exception {
    try (Transaction tx = db.beginTx()) {
        Node node = tx.createNode(label1);
        node.setProperty(property1, "value");
        tx.commit();
    }
    try (Transaction tx = db.beginTx()) {
        tx.execute("CREATE FULLTEXT INDEX FOR (n:Label1) ON EACH [n.property1]");
        tx.commit();
    }
    dbms.shutdown();
    Config config = defaults(GraphDatabaseSettings.logs_directory, layout.databaseDirectory());
    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(), fs, pageCache, debugContext, layout.databaseDirectory(), DEFAULT, NULL, INSTANCE);
    } finally {
        pageCache.close();
        jobScheduler.close();
    }
    assertTrue(result.isSuccessful());
    assertThat(output.toString()).contains("IndexChecker[entityType:NODE,indexesToCheck:1]").containsPattern("NodeChecker\\[highId:.,indexesToCheck:0\\]");
}
Also used : JobScheduler(org.neo4j.scheduler.JobScheduler) MemoryPools(org.neo4j.memory.MemoryPools) Transaction(org.neo4j.graphdb.Transaction) Config(org.neo4j.configuration.Config) Node(org.neo4j.graphdb.Node) ConsistencyCheckService(org.neo4j.consistency.ConsistencyCheckService) ConfiguringPageCacheFactory(org.neo4j.kernel.impl.pagecache.ConfiguringPageCacheFactory) PageCache(org.neo4j.io.pagecache.PageCache) Test(org.junit.jupiter.api.Test)

Example 12 with ConfiguringPageCacheFactory

use of org.neo4j.kernel.impl.pagecache.ConfiguringPageCacheFactory in project neo4j by neo4j.

the class ConsistencyCheckService method runFullConsistencyCheck.

public Result runFullConsistencyCheck(DatabaseLayout databaseLayout, Config config, ProgressMonitorFactory progressFactory, LogProvider logProvider, FileSystemAbstraction fileSystem, boolean verbose, Path reportDir, ConsistencyFlags consistencyFlags) throws ConsistencyCheckIncompleteException {
    Log log = logProvider.getLog(getClass());
    JobScheduler jobScheduler = JobSchedulerFactory.createInitialisedScheduler();
    var pageCacheTracer = PageCacheTracer.NULL;
    var memoryTracker = EmptyMemoryTracker.INSTANCE;
    ConfiguringPageCacheFactory pageCacheFactory = new ConfiguringPageCacheFactory(fileSystem, config, pageCacheTracer, logProvider.getLog(PageCache.class), jobScheduler, Clocks.nanoClock(), new MemoryPools(config.get(memory_tracking)));
    PageCache pageCache = pageCacheFactory.getOrCreatePageCache();
    try {
        return runFullConsistencyCheck(databaseLayout, config, progressFactory, logProvider, fileSystem, pageCache, verbose, reportDir, consistencyFlags, pageCacheTracer, memoryTracker);
    } finally {
        try {
            pageCache.close();
        } catch (Exception e) {
            log.error("Failure during shutdown of the page cache", e);
        }
        try {
            jobScheduler.close();
        } catch (Exception e) {
            log.error("Failure during shutdown of the job scheduler", e);
        }
    }
}
Also used : JobScheduler(org.neo4j.scheduler.JobScheduler) MemoryPools(org.neo4j.memory.MemoryPools) 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)

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