CheckPoint lastCheckPoint = logTailInformation.lastCheckPoint; long txIdAfterLastCheckPoint = logTailInformation.firstTxIdAfterLastCheckPoint; if ( !logTailInformation.commitsAfterLastCheckpoint() )
CheckPoint lastCheckPoint = logTailInformation.lastCheckPoint; long txIdAfterLastCheckPoint = logTailInformation.firstTxIdAfterLastCheckPoint; if ( !logTailInformation.commitsAfterLastCheckpoint() )
private Result checkCleanShutDownByCheckPoint() { // check version try { if ( !tailScanner.getTailInformation().commitsAfterLastCheckpoint() ) { return new Result( Result.Outcome.ok, null, null ); } } catch ( Throwable throwable ) { // ignore exception and return db not cleanly shutdown } return new Result( Result.Outcome.storeNotCleanlyShutDown, null, null ); }
public static void removeCheckPointFromTxLog( FileSystemAbstraction fileSystem, File databaseDirectory ) throws IOException { LogFiles logFiles = LogFilesBuilder.logFilesBasedOnlyBuilder( databaseDirectory, fileSystem ).build(); LogEntryReader<ReadableClosablePositionAwareChannel> logEntryReader = new VersionAwareLogEntryReader<>(); LogTailScanner tailScanner = new LogTailScanner( logFiles, logEntryReader, new Monitors() ); LogTailScanner.LogTailInformation logTailInformation = tailScanner.getTailInformation(); if ( logTailInformation.commitsAfterLastCheckpoint() ) { // done already return; } // let's assume there is at least a checkpoint assertNotNull( logTailInformation.lastCheckPoint ); LogPosition logPosition = logTailInformation.lastCheckPoint.getLogPosition(); File logFile = logFiles.getLogFileForVersion( logPosition.getLogVersion() ); fileSystem.truncate( logFile, logPosition.getByteOffset() ); } }
private Result checkCleanShutDownByCheckPoint() { // check version try { if ( !tailScanner.getTailInformation().commitsAfterLastCheckpoint() ) { return new Result( Result.Outcome.ok, null, null ); } } catch ( Throwable throwable ) { // ignore exception and return db not cleanly shutdown } return new Result( Result.Outcome.storeNotCleanlyShutDown, null, null ); }
private void assertLatestCheckPoint( boolean hasCheckPointEntry, boolean commitsAfterLastCheckPoint, long firstTxIdAfterLastCheckPoint, long logVersion, LogTailInformation logTailInformation ) { assertEquals( hasCheckPointEntry, logTailInformation.lastCheckPoint != null ); assertEquals( commitsAfterLastCheckPoint, logTailInformation.commitsAfterLastCheckpoint() ); if ( commitsAfterLastCheckPoint ) { assertEquals( firstTxIdAfterLastCheckPoint, logTailInformation.firstTxIdAfterLastCheckPoint ); } assertEquals( logVersion, logTailInformation.oldestLogVersionFound ); }