Search in sources :

Example 1 with TemporaryStoreDirectory

use of org.neo4j.causalclustering.catchup.storecopy.TemporaryStoreDirectory in project neo4j by neo4j.

the class StartStopLoad method assertStoreConsistent.

private void assertStoreConsistent(String storeDir, KernelExtensions kernelExtensions) {
    File fromDirectory = new File(storeDir);
    File parent = fromDirectory.getParentFile();
    try (TemporaryStoreDirectory storeDirectory = new TemporaryStoreDirectory(fs, pageCache, parent);
        PageCache pageCache = StandalonePageCacheFactory.createPageCache(fs)) {
        fs.copyRecursively(fromDirectory, storeDirectory.storeDir());
        new CopiedStoreRecovery(Config.defaults(), kernelExtensions.listFactories(), pageCache).recoverCopiedStore(storeDirectory.storeDir());
        ConsistencyCheckService.Result result = runConsistencyCheckTool(new String[] { storeDir });
        if (!result.isSuccessful()) {
            throw new RuntimeException("Not consistent database in " + storeDir);
        }
    } catch (Throwable e) {
        throw new RuntimeException("Failed to run CC on " + storeDir, e);
    }
}
Also used : CopiedStoreRecovery(org.neo4j.causalclustering.catchup.storecopy.CopiedStoreRecovery) ConsistencyCheckService(org.neo4j.consistency.ConsistencyCheckService) TemporaryStoreDirectory(org.neo4j.causalclustering.catchup.storecopy.TemporaryStoreDirectory) File(java.io.File) PageCache(org.neo4j.io.pagecache.PageCache)

Aggregations

File (java.io.File)1 CopiedStoreRecovery (org.neo4j.causalclustering.catchup.storecopy.CopiedStoreRecovery)1 TemporaryStoreDirectory (org.neo4j.causalclustering.catchup.storecopy.TemporaryStoreDirectory)1 ConsistencyCheckService (org.neo4j.consistency.ConsistencyCheckService)1 PageCache (org.neo4j.io.pagecache.PageCache)1