Search in sources :

Example 6 with LatestCheckPoint

use of org.neo4j.kernel.recovery.LatestCheckPointFinder.LatestCheckPoint in project neo4j by neo4j.

the class LatestCheckPointFinderTest method oneLogFileNoCheckPointsOneStart.

@Test
public void oneLogFileNoCheckPointsOneStart() throws Throwable {
    // given
    int logVersion = endLogVersion;
    long txId = 10;
    setupLogFiles(logFile(start(), commit(txId)));
    // when
    LatestCheckPoint latestCheckPoint = finder.find(logVersion);
    // then
    assertLatestCheckPoint(false, true, txId, logVersion, latestCheckPoint);
}
Also used : LatestCheckPoint(org.neo4j.kernel.recovery.LatestCheckPointFinder.LatestCheckPoint) LatestCheckPoint(org.neo4j.kernel.recovery.LatestCheckPointFinder.LatestCheckPoint) Test(org.junit.Test)

Example 7 with LatestCheckPoint

use of org.neo4j.kernel.recovery.LatestCheckPointFinder.LatestCheckPoint in project neo4j by neo4j.

the class UpgradableDatabase method checkCleanShutDownByCheckPoint.

private Result checkCleanShutDownByCheckPoint(File storeDirectory) {
    // check version
    PhysicalLogFiles logFiles = new PhysicalLogFiles(storeDirectory, fs);
    LogEntryReader<ReadableClosablePositionAwareChannel> logEntryReader = new VersionAwareLogEntryReader<>();
    LatestCheckPointFinder latestCheckPointFinder = new LatestCheckPointFinder(logFiles, fs, logEntryReader);
    try {
        LatestCheckPoint latestCheckPoint = latestCheckPointFinder.find(logFiles.getHighestLogVersion());
        if (!latestCheckPoint.commitsAfterCheckPoint) {
            return new Result(Result.Outcome.ok, null, null);
        }
    } catch (IOException e) {
    // ignore exception and return db not cleanly shutdown
    }
    return new Result(Result.Outcome.storeNotCleanlyShutDown, null, null);
}
Also used : LatestCheckPointFinder(org.neo4j.kernel.recovery.LatestCheckPointFinder) LatestCheckPoint(org.neo4j.kernel.recovery.LatestCheckPointFinder.LatestCheckPoint) VersionAwareLogEntryReader(org.neo4j.kernel.impl.transaction.log.entry.VersionAwareLogEntryReader) IOException(java.io.IOException) PhysicalLogFiles(org.neo4j.kernel.impl.transaction.log.PhysicalLogFiles) ReadableClosablePositionAwareChannel(org.neo4j.kernel.impl.transaction.log.ReadableClosablePositionAwareChannel) Result(org.neo4j.kernel.impl.storemigration.StoreVersionCheck.Result)

Example 8 with LatestCheckPoint

use of org.neo4j.kernel.recovery.LatestCheckPointFinder.LatestCheckPoint in project neo4j by neo4j.

the class LatestCheckPointFinderTest method olderLogFileContainingACheckPointAndNewerFileIsEmpty.

@Test
public void olderLogFileContainingACheckPointAndNewerFileIsEmpty() throws Throwable {
    // given
    StartEntry start = start();
    setupLogFiles(logFile(start, checkPoint()), logFile());
    // when
    LatestCheckPoint latestCheckPoint = finder.find(endLogVersion);
    // then
    assertLatestCheckPoint(true, false, NO_TRANSACTION_ID, startLogVersion, latestCheckPoint);
}
Also used : LatestCheckPoint(org.neo4j.kernel.recovery.LatestCheckPointFinder.LatestCheckPoint) Test(org.junit.Test)

Example 9 with LatestCheckPoint

use of org.neo4j.kernel.recovery.LatestCheckPointFinder.LatestCheckPoint in project neo4j by neo4j.

the class LatestCheckPointFinderTest method twoLogFilesNoCheckPointsOneStart.

@Test
public void twoLogFilesNoCheckPointsOneStart() throws Throwable {
    // given
    long txId = 21;
    setupLogFiles(logFile(), logFile(start(), commit(txId)));
    // when
    LatestCheckPoint latestCheckPoint = finder.find(endLogVersion);
    // then
    assertLatestCheckPoint(false, true, txId, startLogVersion, latestCheckPoint);
}
Also used : LatestCheckPoint(org.neo4j.kernel.recovery.LatestCheckPointFinder.LatestCheckPoint) Test(org.junit.Test)

Example 10 with LatestCheckPoint

use of org.neo4j.kernel.recovery.LatestCheckPointFinder.LatestCheckPoint in project neo4j by neo4j.

the class LatestCheckPointFinderTest method olderLogFileContainingAStartAndNewerFileContainingACheckPointPointingToALaterPositionThanStart.

@Test
public void olderLogFileContainingAStartAndNewerFileContainingACheckPointPointingToALaterPositionThanStart() throws Throwable {
    // given
    PositionEntry position = position();
    setupLogFiles(logFile(start(), commit(3), position), logFile(checkPoint(position)));
    // when
    LatestCheckPoint latestCheckPoint = finder.find(endLogVersion);
    // then
    assertLatestCheckPoint(true, false, NO_TRANSACTION_ID, endLogVersion, latestCheckPoint);
}
Also used : LatestCheckPoint(org.neo4j.kernel.recovery.LatestCheckPointFinder.LatestCheckPoint) Test(org.junit.Test)

Aggregations

LatestCheckPoint (org.neo4j.kernel.recovery.LatestCheckPointFinder.LatestCheckPoint)25 Test (org.junit.Test)24 LogPosition (org.neo4j.kernel.impl.transaction.log.LogPosition)3 IOException (java.io.IOException)1 UnderlyingStorageException (org.neo4j.kernel.impl.store.UnderlyingStorageException)1 Result (org.neo4j.kernel.impl.storemigration.StoreVersionCheck.Result)1 PhysicalLogFiles (org.neo4j.kernel.impl.transaction.log.PhysicalLogFiles)1 ReadableClosablePositionAwareChannel (org.neo4j.kernel.impl.transaction.log.ReadableClosablePositionAwareChannel)1 CheckPoint (org.neo4j.kernel.impl.transaction.log.entry.CheckPoint)1 VersionAwareLogEntryReader (org.neo4j.kernel.impl.transaction.log.entry.VersionAwareLogEntryReader)1 LatestCheckPointFinder (org.neo4j.kernel.recovery.LatestCheckPointFinder)1