use of org.neo4j.io.layout.DatabaseLayout in project neo4j by neo4j.
the class RecoveryIT method recoverySetsCheckpointLogVersionFieldNoCheckpointFiles.
@Test
void recoverySetsCheckpointLogVersionFieldNoCheckpointFiles() throws Exception {
GraphDatabaseAPI db = createDatabase();
generateSomeData(db);
DatabaseLayout layout = db.databaseLayout();
managementService.shutdown();
removeFileWithCheckpoint();
assertTrue(isRecoveryRequired(layout));
MetaDataStore.setRecord(pageCache, layout.metadataStore(), CHECKPOINT_LOG_VERSION, -5, layout.getDatabaseName(), NULL);
recoverDatabase();
assertFalse(isRecoveryRequired(layout));
assertEquals(0, MetaDataStore.getRecord(pageCache, layout.metadataStore(), CHECKPOINT_LOG_VERSION, layout.getDatabaseName(), NULL));
}
use of org.neo4j.io.layout.DatabaseLayout in project neo4j by neo4j.
the class KernelDiagnosticsTest method shouldCountFileSizeRecursively.
@Test
void shouldCountFileSizeRecursively() throws IOException {
// file structure:
// storeDir/indexDir/indexFile (1 kB)
// storeDir/neostore (3 kB)
Path storeDir = testDirectory.directory("storedir");
DatabaseLayout layout = DatabaseLayout.ofFlat(storeDir);
Path indexDir = directory(storeDir, "indexDir");
file(indexDir, "indexFile", (int) kibiBytes(1));
file(storeDir, layout.metadataStore().getFileName().toString(), (int) kibiBytes(3));
StorageEngineFactory storageEngineFactory = mock(StorageEngineFactory.class);
when(storageEngineFactory.listStorageFiles(any(), any())).thenReturn(singletonList(layout.metadataStore()));
AssertableLogProvider logProvider = new AssertableLogProvider();
StoreFilesDiagnostics storeFiles = new StoreFilesDiagnostics(storageEngineFactory, fs, layout);
storeFiles.dump(logProvider.getLog(getClass())::debug);
assertThat(logProvider).containsMessages("Total size of store: 4.000KiB", "Total size of mapped files: 3.000KiB");
}
use of org.neo4j.io.layout.DatabaseLayout in project neo4j by neo4j.
the class AllNodesInStoreExistInLabelIndexTest method fullConsistencyCheck.
ConsistencyCheckService.Result fullConsistencyCheck() throws ConsistencyCheckIncompleteException {
ConsistencyCheckService service = new ConsistencyCheckService();
DatabaseLayout databaseLayout = db.databaseLayout();
Config config = Config.defaults(logs_directory, databaseLayout.databaseDirectory());
return service.runFullConsistencyCheck(databaseLayout, addAdditionalConfigToCC(config), NONE, log, false, ConsistencyFlags.DEFAULT);
}
use of org.neo4j.io.layout.DatabaseLayout in project neo4j by neo4j.
the class IndexConsistencyIT method reportNotCleanNativeIndex.
@Test
void reportNotCleanNativeIndex() throws IOException, ConsistencyCheckIncompleteException {
DatabaseLayout databaseLayout = db.databaseLayout();
someData();
checkPointer.forceCheckPoint(new SimpleTriggerInfo("forcedCheckpoint"));
Path indexesCopy = databaseLayout.file("indexesCopy");
Path indexSources = indexProviderMap.getDefaultProvider().directoryStructure().rootDirectory();
copyDirectory(indexSources, indexesCopy, SOURCE_COPY_FILE_FILTER);
try (Transaction tx = db.beginTx()) {
createNewNode(tx, new Label[] { LABEL_ONE });
tx.commit();
}
managementService.shutdown();
copyDirectory(indexesCopy, indexSources);
ConsistencyCheckService.Result result = fullConsistencyCheck();
assertFalse(result.isSuccessful(), "Expected consistency check to fail");
assertThat(readReport(result)).contains("WARN Index was dirty on startup which means it was not shutdown correctly and need to be cleaned up with a successful recovery.");
}
use of org.neo4j.io.layout.DatabaseLayout in project neo4j by neo4j.
the class IndexConsistencyIT method reportNotCleanNativeIndexWithCorrectData.
@Test
void reportNotCleanNativeIndexWithCorrectData() throws IOException, ConsistencyCheckIncompleteException {
DatabaseLayout databaseLayout = db.databaseLayout();
someData();
checkPointer.forceCheckPoint(new SimpleTriggerInfo("forcedCheckpoint"));
Path indexesCopy = databaseLayout.file("indexesCopy");
Path indexSources = indexProviderMap.getDefaultProvider().directoryStructure().rootDirectory();
copyDirectory(indexSources, indexesCopy, SOURCE_COPY_FILE_FILTER);
managementService.shutdown();
copyDirectory(indexesCopy, indexSources);
ConsistencyCheckService.Result result = fullConsistencyCheck();
assertTrue(result.isSuccessful(), "Expected consistency check to fail");
assertThat(readReport(result)).contains("WARN Index was dirty on startup which means it was not shutdown correctly and need to be cleaned up with a successful recovery.");
}
Aggregations