use of org.neo4j.tools.txlog.checktypes.CheckTypes.CHECK_TYPES in project neo4j by neo4j.
the class CheckTxLogsTest method shouldReportNoInconsistenciesIfTxIdSequenceIsStriclyIncreasingAndHasNoGaps.
@Test
public void shouldReportNoInconsistenciesIfTxIdSequenceIsStriclyIncreasingAndHasNoGaps() throws Exception {
// given
Function<Long, Command.NodeCommand> newNodeCommandFunction = (i) -> new Command.NodeCommand(new NodeRecord(i, false, false, -1, -1, -1), new NodeRecord(i, true, false, -1, -1, -1));
writeTxContent(logFile(1), 40L, newNodeCommandFunction.apply(1L));
writeTxContent(logFile(1), 41L, newNodeCommandFunction.apply(2L));
writeTxContent(logFile(1), 42L, newNodeCommandFunction.apply(3L));
writeTxContent(logFile(2), 43L, newNodeCommandFunction.apply(4L));
writeTxContent(logFile(2), 44L, newNodeCommandFunction.apply(5L));
writeTxContent(logFile(2), 45L, newNodeCommandFunction.apply(6L));
CapturingInconsistenciesHandler handler = new CapturingInconsistenciesHandler();
CheckTxLogs checker = new CheckTxLogs(System.out, fsRule.get());
// when
checker.scan(new PhysicalLogFiles(storeDirectory, fsRule.get()), handler, CHECK_TYPES);
// then
assertTrue(handler.txIdSequenceInconsistencies.isEmpty());
}
use of org.neo4j.tools.txlog.checktypes.CheckTypes.CHECK_TYPES in project neo4j by neo4j.
the class CheckTxLogsTest method shouldReportAnInconsistencyIfTxIdSequenceHasGaps.
@Test
public void shouldReportAnInconsistencyIfTxIdSequenceHasGaps() throws Exception {
// given
Function<Long, Command.NodeCommand> newNodeCommandFunction = (i) -> new Command.NodeCommand(new NodeRecord(i, false, false, -1, -1, -1), new NodeRecord(i, true, false, -1, -1, -1));
writeTxContent(logFile(1), 40L, newNodeCommandFunction.apply(1L));
writeTxContent(logFile(1), 41L, newNodeCommandFunction.apply(2L));
writeTxContent(logFile(1), 42L, newNodeCommandFunction.apply(3L));
writeTxContent(logFile(2), 44L, newNodeCommandFunction.apply(4L));
writeTxContent(logFile(2), 45L, newNodeCommandFunction.apply(5L));
CapturingInconsistenciesHandler handler = new CapturingInconsistenciesHandler();
CheckTxLogs checker = new CheckTxLogs(System.out, fsRule.get());
// when
checker.scan(new PhysicalLogFiles(storeDirectory, fsRule.get()), handler, CHECK_TYPES);
// then
System.out.println(handler.txIdSequenceInconsistencies);
assertEquals(1, handler.txIdSequenceInconsistencies.size());
assertEquals(42, handler.txIdSequenceInconsistencies.get(0).lastSeenTxId);
assertEquals(44, handler.txIdSequenceInconsistencies.get(0).currentTxId);
}
use of org.neo4j.tools.txlog.checktypes.CheckTypes.CHECK_TYPES in project neo4j by neo4j.
the class CheckTxLogsTest method shouldReportAnInconsistencyIfTxIdSequenceIsNotStrictlyIncreasing.
@Test
public void shouldReportAnInconsistencyIfTxIdSequenceIsNotStrictlyIncreasing() throws Exception {
// given
Function<Long, Command.NodeCommand> newNodeCommandFunction = (i) -> new Command.NodeCommand(new NodeRecord(i, false, false, -1, -1, -1), new NodeRecord(i, true, false, -1, -1, -1));
writeTxContent(logFile(1), 40L, newNodeCommandFunction.apply(1L));
writeTxContent(logFile(1), 41L, newNodeCommandFunction.apply(2L));
writeTxContent(logFile(1), 42L, newNodeCommandFunction.apply(3L));
writeTxContent(logFile(2), 42L, newNodeCommandFunction.apply(4L));
writeTxContent(logFile(2), 43L, newNodeCommandFunction.apply(5L));
CapturingInconsistenciesHandler handler = new CapturingInconsistenciesHandler();
CheckTxLogs checker = new CheckTxLogs(System.out, fsRule.get());
// when
checker.scan(new PhysicalLogFiles(storeDirectory, fsRule.get()), handler, CHECK_TYPES);
// then
assertEquals(1, handler.txIdSequenceInconsistencies.size());
assertEquals(42, handler.txIdSequenceInconsistencies.get(0).lastSeenTxId);
assertEquals(42, handler.txIdSequenceInconsistencies.get(0).currentTxId);
}
Aggregations