Search in sources :

Example 1 with GBPTreeBootstrapper

use of org.neo4j.index.internal.gbptree.GBPTreeBootstrapper in project neo4j by neo4j.

the class ConsistencyCheckWithCorruptGBPTreeIT method corruptIndexes.

private List<Path> corruptIndexes(FileSystemAbstraction fs, DatabaseReadOnlyChecker readOnlyChecker, CorruptionInject corruptionInject, LayoutBootstrapper layoutBootstrapper, Path... targetFiles) throws Exception {
    List<Path> treeFiles = new ArrayList<>();
    try (JobScheduler jobScheduler = createInitialisedScheduler();
        GBPTreeBootstrapper bootstrapper = new GBPTreeBootstrapper(fs, jobScheduler, layoutBootstrapper, readOnlyChecker, NULL)) {
        for (Path file : targetFiles) {
            GBPTreeBootstrapper.Bootstrap bootstrap = bootstrapper.bootstrapTree(file, NO_FLUSH_ON_CLOSE);
            if (bootstrap.isTree()) {
                treeFiles.add(file);
                try (GBPTree<?, ?> gbpTree = bootstrap.getTree()) {
                    InspectingVisitor<?, ?> visitor = gbpTree.visit(new InspectingVisitor<>(), CursorContext.NULL);
                    corruptionInject.corrupt(gbpTree, visitor.get());
                }
            }
        }
    }
    return treeFiles;
}
Also used : Path(java.nio.file.Path) JobScheduler(org.neo4j.scheduler.JobScheduler) GBPTreeBootstrapper(org.neo4j.index.internal.gbptree.GBPTreeBootstrapper) ArrayList(java.util.ArrayList)

Aggregations

Path (java.nio.file.Path)1 ArrayList (java.util.ArrayList)1 GBPTreeBootstrapper (org.neo4j.index.internal.gbptree.GBPTreeBootstrapper)1 JobScheduler (org.neo4j.scheduler.JobScheduler)1