Search in sources :

Example 1 with PositionToRecoverFrom

use of org.neo4j.kernel.recovery.PositionToRecoverFrom in project neo4j by neo4j.

the class RecoveryRequiredChecker method isRecoveryRequiredAt.

public boolean isRecoveryRequiredAt(File dataDir) throws IOException {
    File neoStore = new File(dataDir, MetaDataStore.DEFAULT_NAME);
    boolean noStoreFound = !NeoStores.isStorePresent(pageCache, dataDir);
    // We need config to determine where the logical log files are
    if (noStoreFound) {
        // No database in the specified directory.
        return false;
    }
    long logVersion = MetaDataStore.getRecord(pageCache, neoStore, MetaDataStore.Position.LOG_VERSION);
    PhysicalLogFiles logFiles = new PhysicalLogFiles(dataDir, fs);
    LogEntryReader<ReadableClosablePositionAwareChannel> reader = new VersionAwareLogEntryReader<>();
    LatestCheckPointFinder finder = new LatestCheckPointFinder(logFiles, fs, reader);
    return new PositionToRecoverFrom(finder, NO_MONITOR).apply(logVersion) != LogPosition.UNSPECIFIED;
}
Also used : LatestCheckPointFinder(org.neo4j.kernel.recovery.LatestCheckPointFinder) PositionToRecoverFrom(org.neo4j.kernel.recovery.PositionToRecoverFrom) VersionAwareLogEntryReader(org.neo4j.kernel.impl.transaction.log.entry.VersionAwareLogEntryReader) File(java.io.File) PhysicalLogFiles(org.neo4j.kernel.impl.transaction.log.PhysicalLogFiles) ReadableClosablePositionAwareChannel(org.neo4j.kernel.impl.transaction.log.ReadableClosablePositionAwareChannel)

Aggregations

File (java.io.File)1 PhysicalLogFiles (org.neo4j.kernel.impl.transaction.log.PhysicalLogFiles)1 ReadableClosablePositionAwareChannel (org.neo4j.kernel.impl.transaction.log.ReadableClosablePositionAwareChannel)1 VersionAwareLogEntryReader (org.neo4j.kernel.impl.transaction.log.entry.VersionAwareLogEntryReader)1 LatestCheckPointFinder (org.neo4j.kernel.recovery.LatestCheckPointFinder)1 PositionToRecoverFrom (org.neo4j.kernel.recovery.PositionToRecoverFrom)1