use of org.neo4j.kernel.recovery.LatestCheckPointFinder.LatestCheckPoint in project neo4j by neo4j.
the class LatestCheckPointFinderTest method olderLogFileContainingAStartAndNewerFileContainingACheckPointPointingToAPreviousPositionThanStart.
@Test
public void olderLogFileContainingAStartAndNewerFileContainingACheckPointPointingToAPreviousPositionThanStart() throws Throwable {
// given
long txId = 123;
StartEntry start = start();
setupLogFiles(logFile(start, commit(txId)), logFile(checkPoint(start)));
// when
LatestCheckPoint latestCheckPoint = finder.find(endLogVersion);
// then
assertLatestCheckPoint(true, true, txId, endLogVersion, latestCheckPoint);
}
use of org.neo4j.kernel.recovery.LatestCheckPointFinder.LatestCheckPoint in project neo4j by neo4j.
the class PositionToRecoverFromTest method shouldReturnUnspecifiedIfThereIsNoNeedForRecovery.
@Test
public void shouldReturnUnspecifiedIfThereIsNoNeedForRecovery() throws Throwable {
// given
when(finder.find(logVersion)).thenReturn(new LatestCheckPoint(null, false, NO_TRANSACTION_ID, logVersion));
// when
LogPosition logPosition = new PositionToRecoverFrom(finder, monitor).apply(logVersion);
// then
verify(monitor).noCommitsAfterLastCheckPoint(null);
assertEquals(LogPosition.UNSPECIFIED, logPosition);
}
use of org.neo4j.kernel.recovery.LatestCheckPointFinder.LatestCheckPoint in project neo4j by neo4j.
the class PositionToRecoverFromTest method shouldRecoverFromStartOfLogZeroIfThereAreNoCheckPointAndOldestLogIsVersionZero.
@Test
public void shouldRecoverFromStartOfLogZeroIfThereAreNoCheckPointAndOldestLogIsVersionZero() throws Throwable {
// given
when(finder.find(logVersion)).thenReturn(new LatestCheckPoint(null, true, 10L, INITIAL_LOG_VERSION));
// when
LogPosition logPosition = new PositionToRecoverFrom(finder, monitor).apply(logVersion);
// then
verify(monitor).noCheckPointFound();
assertEquals(LogPosition.start(INITIAL_LOG_VERSION), logPosition);
}
use of org.neo4j.kernel.recovery.LatestCheckPointFinder.LatestCheckPoint in project neo4j by neo4j.
the class PositionToRecoverFromTest method shouldFailIfThereAreNoCheckPointsAndOldestLogVersionInNotZero.
@Test
public void shouldFailIfThereAreNoCheckPointsAndOldestLogVersionInNotZero() throws Throwable {
// given
long oldestLogVersionFound = 1L;
when(finder.find(logVersion)).thenReturn(new LatestCheckPoint(null, true, 10L, oldestLogVersionFound));
// when
try {
new PositionToRecoverFrom(finder, monitor).apply(logVersion);
} catch (UnderlyingStorageException ex) {
// then
final String expectedMessage = "No check point found in any log file from version " + oldestLogVersionFound + " to " + logVersion;
assertEquals(expectedMessage, ex.getMessage());
}
}
use of org.neo4j.kernel.recovery.LatestCheckPointFinder.LatestCheckPoint in project neo4j by neo4j.
the class PositionToRecoverFromTest method shouldReturnLogPositionToRecoverFromIfNeeded.
@Test
public void shouldReturnLogPositionToRecoverFromIfNeeded() throws Throwable {
// given
LogPosition checkPointLogPosition = new LogPosition(1L, 4242);
when(finder.find(logVersion)).thenReturn(new LatestCheckPoint(new CheckPoint(checkPointLogPosition), true, 10L, logVersion));
// when
LogPosition logPosition = new PositionToRecoverFrom(finder, monitor).apply(logVersion);
// then
verify(monitor).commitsAfterLastCheckPoint(checkPointLogPosition, 10L);
assertEquals(checkPointLogPosition, logPosition);
}
Aggregations