Search in sources :

Example 1 with CheckType

use of org.neo4j.tools.txlog.checktypes.CheckType in project neo4j by neo4j.

the class CheckTxLogs method main.

public static void main(String[] args) throws Exception {
    PrintStream out = System.out;
    Args arguments = Args.withFlags(HELP_FLAG, VALIDATE_CHECKPOINTS_FLAG).parse(args);
    if (arguments.getBoolean(HELP_FLAG)) {
        printUsageAndExit(out);
    }
    boolean validateCheckPoints = arguments.getBoolean(VALIDATE_CHECKPOINTS_FLAG);
    CheckType<?, ?>[] checkTypes = parseChecks(arguments);
    File dir = parseDir(out, arguments);
    boolean success = false;
    try (FileSystemAbstraction fs = new DefaultFileSystemAbstraction()) {
        PhysicalLogFiles logFiles = new PhysicalLogFiles(dir, fs);
        int numberOfLogFilesFound = (int) (logFiles.getHighestLogVersion() - logFiles.getLowestLogVersion() + 1);
        out.println("Found " + numberOfLogFilesFound + " log files to verify in " + dir.getCanonicalPath());
        CheckTxLogs tool = new CheckTxLogs(out, fs);
        PrintingInconsistenciesHandler handler = new PrintingInconsistenciesHandler(out);
        success = tool.scan(logFiles, handler, checkTypes);
        if (validateCheckPoints) {
            success &= tool.validateCheckPoints(logFiles, handler);
        }
    }
    if (!success) {
        System.exit(1);
    }
}
Also used : PrintStream(java.io.PrintStream) Args(org.neo4j.helpers.Args) DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) FileSystemAbstraction(org.neo4j.io.fs.FileSystemAbstraction) DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) CheckType(org.neo4j.tools.txlog.checktypes.CheckType) File(java.io.File) CheckPoint(org.neo4j.kernel.impl.transaction.log.entry.CheckPoint) PhysicalLogFiles(org.neo4j.kernel.impl.transaction.log.PhysicalLogFiles)

Aggregations

File (java.io.File)1 PrintStream (java.io.PrintStream)1 Args (org.neo4j.helpers.Args)1 DefaultFileSystemAbstraction (org.neo4j.io.fs.DefaultFileSystemAbstraction)1 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)1 PhysicalLogFiles (org.neo4j.kernel.impl.transaction.log.PhysicalLogFiles)1 CheckPoint (org.neo4j.kernel.impl.transaction.log.entry.CheckPoint)1 CheckType (org.neo4j.tools.txlog.checktypes.CheckType)1