public static List<LogEntry> logEntries( FileSystemAbstraction fileSystem, File file ) throws IOException { return logEntries( fileSystem, file.getPath() ); }
@Test public void shouldHandleWritesProperlyAfterRecovery() throws Exception { // Given EphemeralFileSystemAbstraction fs = fsRule.get(); GraphDatabaseService db = newDB( fs ); long node1 = createNode( db ); // And given the power goes out try ( EphemeralFileSystemAbstraction crashedFs = fs.snapshot() ) { db.shutdown(); db = newDB( crashedFs ); long node2 = createNode( db ); db.shutdown(); // Then the logical log should be in sync File logFile = testDirectory.databaseLayout().file( TransactionLogFiles.DEFAULT_NAME + ".0" ); assertThat( logEntries( crashedFs, logFile ), containsExactly( // Tx before recovery startEntry( -1, -1 ), commandEntry( node1, NodeCommand.class ), commandEntry( StatementConstants.ANY_LABEL, NodeCountsCommand.class ), commitEntry( 2 ), // Tx after recovery startEntry( -1, -1 ), commandEntry( node2, NodeCommand.class ), commandEntry( StatementConstants.ANY_LABEL, NodeCountsCommand.class ), commitEntry( 3 ), // checkpoint checkPoint( new LogPosition( 0, 250 ) ) ) ); } }