use of org.neo4j.kernel.impl.transaction.log.LogPosition 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.impl.transaction.log.LogPosition 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);
}
use of org.neo4j.kernel.impl.transaction.log.LogPosition in project neo4j by neo4j.
the class StoreMigratorTest method writeAndReadLastTxLogPosition.
@Test
public void writeAndReadLastTxLogPosition() throws IOException {
StoreMigrator migrator = newStoreMigrator();
LogPosition writtenLogPosition = new LogPosition(random.nextLong(), random.nextLong());
migrator.writeLastTxLogPosition(directory.graphDbDir(), writtenLogPosition);
LogPosition readLogPosition = migrator.readLastTxLogPosition(directory.graphDbDir());
assertEquals(writtenLogPosition, readLogPosition);
}
use of org.neo4j.kernel.impl.transaction.log.LogPosition in project neo4j by neo4j.
the class MigrationTestUtils method removeCheckPointFromTxLog.
public static void removeCheckPointFromTxLog(FileSystemAbstraction fileSystem, File workingDirectory) throws IOException {
PhysicalLogFiles logFiles = new PhysicalLogFiles(workingDirectory, fileSystem);
LogEntryReader<ReadableClosablePositionAwareChannel> logEntryReader = new VersionAwareLogEntryReader<>();
LatestCheckPointFinder finder = new LatestCheckPointFinder(logFiles, fileSystem, logEntryReader);
LatestCheckPointFinder.LatestCheckPoint latestCheckPoint = finder.find(logFiles.getHighestLogVersion());
if (latestCheckPoint.commitsAfterCheckPoint) {
// done already
return;
}
// let's assume there is at least a checkpoint
assertNotNull(latestCheckPoint.checkPoint);
LogPosition logPosition = latestCheckPoint.checkPoint.getLogPosition();
File logFile = logFiles.getLogFileForVersion(logPosition.getLogVersion());
fileSystem.truncate(logFile, logPosition.getByteOffset());
}
use of org.neo4j.kernel.impl.transaction.log.LogPosition in project neo4j by neo4j.
the class LogPositionMarkerTest method shouldReturnUnspecifiedIfNothingHasBeenMarked.
@Test
void shouldReturnUnspecifiedIfNothingHasBeenMarked() {
// given
final LogPositionMarker marker = new LogPositionMarker();
// when
final LogPosition logPosition = marker.newPosition();
// given
assertEquals(LogPosition.UNSPECIFIED, logPosition);
}
Aggregations