Search in sources :

Example 6 with LogTailInformation

use of org.neo4j.kernel.impl.transaction.log.files.LogTailInformation in project neo4j by neo4j.

the class AbstractLogTailScannerTest method twoLogFilesNoCheckPointsTwoCommits.

@ParameterizedTest
@MethodSource("params")
void twoLogFilesNoCheckPointsTwoCommits(int startLogVersion, int endLogVersion) {
    // given
    long txId = 21;
    setupLogFiles(endLogVersion, logFile(), logFile(start(), commit(txId), start(), commit(txId + 1)));
    // when
    LogTailInformation logTailInformation = logFiles.getTailInformation();
    // then
    assertLatestCheckPoint(false, true, txId, false, logTailInformation);
}
Also used : LogTailInformation(org.neo4j.kernel.impl.transaction.log.files.LogTailInformation) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 7 with LogTailInformation

use of org.neo4j.kernel.impl.transaction.log.files.LogTailInformation in project neo4j by neo4j.

the class AbstractLogTailScannerTest method olderLogFileContainingAStartAndNewerFileContainingACheckPointPointingToALaterPositionThanStart.

@ParameterizedTest
@MethodSource("params")
void olderLogFileContainingAStartAndNewerFileContainingACheckPointPointingToALaterPositionThanStart(int startLogVersion, int endLogVersion) {
    // given
    PositionEntry position = position();
    setupLogFiles(endLogVersion, logFile(start(), commit(3), position), logFile(checkPoint(position)));
    // when
    LogTailInformation logTailInformation = logFiles.getTailInformation();
    // then
    assertLatestCheckPoint(true, false, NO_TRANSACTION_ID, false, logTailInformation);
}
Also used : LogTailInformation(org.neo4j.kernel.impl.transaction.log.files.LogTailInformation) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 8 with LogTailInformation

use of org.neo4j.kernel.impl.transaction.log.files.LogTailInformation in project neo4j by neo4j.

the class AbstractLogTailScanner method checkpointTailInformation.

LogTailInformation checkpointTailInformation(long highestLogVersion, LogEntryStart latestStartEntry, long oldestVersionFound, byte latestLogEntryVersion, CheckpointInfo latestCheckPoint, boolean corruptedTransactionLogs, StoreId storeId) throws IOException {
    LogPosition checkPointLogPosition = latestCheckPoint.getTransactionLogPosition();
    InlinedLogTailScanner.ExtractedTransactionRecord transactionRecord = extractFirstTxIdAfterPosition(checkPointLogPosition, highestLogVersion);
    long firstTxIdAfterPosition = transactionRecord.getId();
    boolean startRecordAfterCheckpoint = (firstTxIdAfterPosition != NO_TRANSACTION_ID) || ((latestStartEntry != null) && (latestStartEntry.getStartPosition().compareTo(latestCheckPoint.getTransactionLogPosition()) >= 0));
    boolean corruptedLogs = transactionRecord.isFailure() || corruptedTransactionLogs;
    return new LogTailInformation(latestCheckPoint, corruptedLogs || startRecordAfterCheckpoint, firstTxIdAfterPosition, oldestVersionFound == UNKNOWN, highestLogVersion, latestLogEntryVersion, storeId);
}
Also used : LogTailInformation(org.neo4j.kernel.impl.transaction.log.files.LogTailInformation) LogPosition(org.neo4j.kernel.impl.transaction.log.LogPosition)

Example 9 with LogTailInformation

use of org.neo4j.kernel.impl.transaction.log.files.LogTailInformation in project neo4j by neo4j.

the class AbstractLogTailScannerTest method latestLogFileContainingMultipleCheckPointsOneStartInBetween.

@ParameterizedTest
@MethodSource("params")
void latestLogFileContainingMultipleCheckPointsOneStartInBetween(int startLogVersion, int endLogVersion) {
    // given
    setupLogFiles(endLogVersion, logFile(checkPoint(), start(), commit(1), checkPoint()));
    // when
    LogTailInformation logTailInformation = logFiles.getTailInformation();
    // then
    assertLatestCheckPoint(true, false, NO_TRANSACTION_ID, false, logTailInformation);
}
Also used : LogTailInformation(org.neo4j.kernel.impl.transaction.log.files.LogTailInformation) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 10 with LogTailInformation

use of org.neo4j.kernel.impl.transaction.log.files.LogTailInformation in project neo4j by neo4j.

the class AbstractLogTailScannerTest method bigFileLatestCheckpointFindsStartAfter.

@ParameterizedTest
@MethodSource("params")
void bigFileLatestCheckpointFindsStartAfter(int startLogVersion, int endLogVersion) throws IOException {
    long firstTxAfterCheckpoint = Integer.MAX_VALUE + 4L;
    InlinedLogTailScanner tailScanner = new FirstTxIdConfigurableTailScanner(firstTxAfterCheckpoint, logFiles, reader, monitors);
    LogEntryStart startEntry = new LogEntryStart(3L, 4L, 0, new byte[] { 5, 6 }, new LogPosition(endLogVersion, Integer.MAX_VALUE + 17L));
    CheckpointInfo checkPoint = new CheckpointInfo(new LogPosition(endLogVersion, 16L), StoreId.UNKNOWN, LogPosition.UNSPECIFIED);
    LogTailInformation logTailInformation = tailScanner.checkpointTailInformation(endLogVersion, startEntry, endLogVersion, (byte) -1, checkPoint, false, StoreId.UNKNOWN);
    assertLatestCheckPoint(true, true, firstTxAfterCheckpoint, false, logTailInformation);
}
Also used : LogEntryStart(org.neo4j.kernel.impl.transaction.log.entry.LogEntryStart) LogTailInformation(org.neo4j.kernel.impl.transaction.log.files.LogTailInformation) LogPosition(org.neo4j.kernel.impl.transaction.log.LogPosition) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Aggregations

LogTailInformation (org.neo4j.kernel.impl.transaction.log.files.LogTailInformation)34 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)24 MethodSource (org.junit.jupiter.params.provider.MethodSource)23 LogPosition (org.neo4j.kernel.impl.transaction.log.LogPosition)7 Test (org.junit.jupiter.api.Test)6 Path (java.nio.file.Path)3 UnderlyingStorageException (org.neo4j.exceptions.UnderlyingStorageException)2 LogEntryStart (org.neo4j.kernel.impl.transaction.log.entry.LogEntryStart)2 LogFiles (org.neo4j.kernel.impl.transaction.log.files.LogFiles)2 CheckpointInfo (org.neo4j.kernel.impl.transaction.log.files.checkpoint.CheckpointInfo)2 ClosedByInterruptException (java.nio.channels.ClosedByInterruptException)1 DatabaseLayout (org.neo4j.io.layout.DatabaseLayout)1 LogEntryCursor (org.neo4j.kernel.impl.transaction.log.LogEntryCursor)1 LogVersionedStoreChannel (org.neo4j.kernel.impl.transaction.log.LogVersionedStoreChannel)1 ReadAheadLogChannel (org.neo4j.kernel.impl.transaction.log.ReadAheadLogChannel)1 LogEntry (org.neo4j.kernel.impl.transaction.log.entry.LogEntry)1 LogEntryCommit (org.neo4j.kernel.impl.transaction.log.entry.LogEntryCommit)1 LogEntryInlinedCheckPoint (org.neo4j.kernel.impl.transaction.log.entry.LogEntryInlinedCheckPoint)1 LogHeader (org.neo4j.kernel.impl.transaction.log.entry.LogHeader)1 LogFile (org.neo4j.kernel.impl.transaction.log.files.LogFile)1