use of org.neo4j.kernel.impl.storemigration.LegacyTransactionLogsLocator in project neo4j by neo4j.
the class StoreUpgraderInterruptionTestIT method setUpLabelScanStore.
@Before
public void setUpLabelScanStore() {
jobScheduler = new ThreadPoolJobScheduler();
neo4jLayout = Neo4jLayout.of(directory.homePath());
workingDatabaseLayout = neo4jLayout.databaseLayout(DEFAULT_DATABASE_NAME);
prepareDirectory = directory.directory("prepare");
legacyTransactionLogsLocator = new LegacyTransactionLogsLocator(Config.defaults(), workingDatabaseLayout);
pageCache = pageCacheRule.getPageCache(fs);
baselineFormat = RecordFormatSelector.selectForVersion(version);
successorFormat = RecordFormatSelector.findLatestFormatInFamily(baselineFormat).orElse(baselineFormat);
}
use of org.neo4j.kernel.impl.storemigration.LegacyTransactionLogsLocator in project neo4j by neo4j.
the class RecoveryIT method failToStartDatabaseWithTransactionLogsInLegacyLocation.
@Test
void failToStartDatabaseWithTransactionLogsInLegacyLocation() throws Exception {
GraphDatabaseAPI database = createDatabase();
generateSomeData(database);
managementService.shutdown();
LogFiles logFiles = buildLogFiles();
Path[] txLogFiles = fileSystem.listFiles(logFiles.logFilesDirectory(), path -> path.getFileName().toString().startsWith(DEFAULT_NAME));
txLogFiles = ArrayUtil.concat(txLogFiles, logFiles.getCheckpointFile().getDetachedCheckpointFiles());
Path databasesDirectory = databaseLayout.getNeo4jLayout().databasesDirectory();
DatabaseLayout legacyLayout = Neo4jLayout.ofFlat(databasesDirectory).databaseLayout(databaseLayout.getDatabaseName());
LegacyTransactionLogsLocator logsLocator = new LegacyTransactionLogsLocator(Config.defaults(), legacyLayout);
Path transactionLogsDirectory = logsLocator.getTransactionLogsDirectory();
assertNotNull(txLogFiles);
assertTrue(txLogFiles.length > 0);
for (Path logFile : txLogFiles) {
fileSystem.moveToDirectory(logFile, transactionLogsDirectory);
}
AssertableLogProvider logProvider = new AssertableLogProvider();
builder.setInternalLogProvider(logProvider);
GraphDatabaseAPI restartedDb = createDatabase();
try {
DatabaseStateService dbStateService = restartedDb.getDependencyResolver().resolveDependency(DatabaseStateService.class);
var failure = dbStateService.causeOfFailure(restartedDb.databaseId());
assertTrue(failure.isPresent());
assertThat(failure.get()).hasRootCauseMessage("Transaction logs are missing and recovery is not possible.");
assertThat(logProvider.serialize()).contains(txLogFiles[0].getFileName().toString());
} finally {
managementService.shutdown();
}
}
Aggregations