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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations