use of org.neo4j.kernel.impl.transaction.SimpleLogVersionRepository in project neo4j by neo4j.
the class DumpCommandIT method databaseThatRequireRecoveryIsNotDumpable.
@Test
void databaseThatRequireRecoveryIsNotDumpable() throws IOException {
LogFiles logFiles = LogFilesBuilder.builder(databaseLayout, testDirectory.getFileSystem()).withLogVersionRepository(new SimpleLogVersionRepository()).withTransactionIdStore(new SimpleTransactionIdStore()).withCommandReaderFactory(StorageEngineFactory.defaultStorageEngine().commandReaderFactory()).withStoreId(StoreId.UNKNOWN).build();
try (Lifespan ignored = new Lifespan(logFiles)) {
LogFile logFile = logFiles.getLogFile();
LogEntryWriter writer = logFile.getTransactionLogWriter().getWriter();
writer.writeStartEntry(0x123456789ABCDEFL, logFile.getLogFileInformation().getLastEntryId() + 1, BASE_TX_CHECKSUM, new byte[] { 0 });
}
CommandFailedException commandFailed = assertThrows(CommandFailedException.class, () -> execute("foo"));
assertThat(commandFailed.getMessage()).startsWith("Active logical log detected, this might be a source of inconsistencies.");
}
use of org.neo4j.kernel.impl.transaction.SimpleLogVersionRepository in project neo4j by neo4j.
the class VersionAwareLogEntryReaderIT method correctlyResetPositionWhenEndOfCommandsReached.
@Test
void correctlyResetPositionWhenEndOfCommandsReached() throws IOException {
LogFiles logFiles = LogFilesBuilder.builder(databaseLayout, fs).withLogEntryReader(entryReader).withLogVersionRepository(new SimpleLogVersionRepository()).withTransactionIdStore(new SimpleTransactionIdStore()).withStoreId(StoreId.UNKNOWN).build();
try (Lifespan lifespan = new Lifespan(logFiles)) {
LogPosition logPosition = entryReader.lastPosition();
assertEquals(0L, logPosition.getLogVersion());
// this position in a log file before 0's are actually starting
assertEquals(END_OF_DATA_OFFSET, logPosition.getByteOffset());
for (int i = 0; i < 10; i++) {
assertEquals(END_OF_DATA_OFFSET, getLastReadablePosition(logFiles));
}
}
}
use of org.neo4j.kernel.impl.transaction.SimpleLogVersionRepository in project neo4j by neo4j.
the class VersionAwareLogEntryReaderIT method readOnlyLogFilesWhileCommandsAreAvailable.
@Test
@EnabledOnOs(OS.LINUX)
void readOnlyLogFilesWhileCommandsAreAvailable() throws IOException {
LogFiles logFiles = LogFilesBuilder.builder(databaseLayout, fs).withLogEntryReader(entryReader).withLogVersionRepository(new SimpleLogVersionRepository()).withTransactionIdStore(new SimpleTransactionIdStore()).withStoreId(StoreId.UNKNOWN).build();
try (Lifespan lifespan = new Lifespan(logFiles)) {
assertEquals(kibiBytes(128), Files.size(logFiles.getLogFile().getHighestLogFile()));
LogPosition logPosition = entryReader.lastPosition();
assertEquals(0L, logPosition.getLogVersion());
// this position in a log file before 0's are actually starting
assertEquals(END_OF_DATA_OFFSET, logPosition.getByteOffset());
}
}
use of org.neo4j.kernel.impl.transaction.SimpleLogVersionRepository in project neo4j by neo4j.
the class VersionAwareLogEntryReaderIT method readTillTheEndOfNotPreallocatedFile.
@Test
@DisabledOnOs(OS.LINUX)
void readTillTheEndOfNotPreallocatedFile() throws IOException {
LogFiles logFiles = LogFilesBuilder.builder(databaseLayout, fs).withLogEntryReader(entryReader).withLogVersionRepository(new SimpleLogVersionRepository()).withTransactionIdStore(new SimpleTransactionIdStore()).withStoreId(StoreId.UNKNOWN).build();
try (Lifespan lifespan = new Lifespan(logFiles)) {
LogPosition logPosition = entryReader.lastPosition();
assertEquals(0L, logPosition.getLogVersion());
assertEquals(Files.size(logFiles.getLogFile().getHighestLogFile()), logPosition.getByteOffset());
}
}
use of org.neo4j.kernel.impl.transaction.SimpleLogVersionRepository in project neo4j by neo4j.
the class CorruptedLogsTruncatorTest method setUp.
@BeforeEach
void setUp() throws Exception {
databaseDirectory = testDirectory.homePath();
logVersionRepository = new SimpleLogVersionRepository();
SimpleTransactionIdStore transactionIdStore = new SimpleTransactionIdStore();
logFiles = LogFilesBuilder.logFilesBasedOnlyBuilder(databaseDirectory, fs).withRotationThreshold(SINGLE_LOG_FILE_SIZE).withLogVersionRepository(logVersionRepository).withTransactionIdStore(transactionIdStore).withLogEntryReader(logEntryReader()).withStoreId(StoreId.UNKNOWN).withConfig(Config.newBuilder().set(GraphDatabaseInternalSettings.checkpoint_logical_log_rotation_threshold, 1024L).build()).build();
life.add(logFiles);
logPruner = new CorruptedLogsTruncator(databaseDirectory, logFiles, fs, INSTANCE);
}
Aggregations