Search in sources :

Example 1 with StoreFilesDiagnostics

use of org.neo4j.kernel.diagnostics.providers.StoreFilesDiagnostics in project neo4j by neo4j.

the class KernelDiagnosticsIT method shouldIncludeNativeIndexFilesInTotalMappedSize.

@Test
void shouldIncludeNativeIndexFilesInTotalMappedSize() {
    for (GraphDatabaseSettings.SchemaIndex schemaIndex : GraphDatabaseSettings.SchemaIndex.values()) {
        // given
        Neo4jLayout layout = neo4jLayout;
        createIndexInIsolatedDbInstance(layout.homeDirectory(), schemaIndex);
        // when
        DatabaseLayout databaseLayout = layout.databaseLayout(DEFAULT_DATABASE_NAME);
        StorageEngineFactory storageEngineFactory = StorageEngineFactory.defaultStorageEngine();
        StoreFilesDiagnostics files = new StoreFilesDiagnostics(storageEngineFactory, fs, databaseLayout);
        SizeCapture capture = new SizeCapture();
        files.dump(capture::log);
        assertNotNull(capture.size);
        // then
        long expected = manuallyCountTotalMappedFileSize(databaseLayout.databaseDirectory());
        assertEquals(bytesToString(expected), capture.size);
    }
}
Also used : GraphDatabaseSettings(org.neo4j.configuration.GraphDatabaseSettings) StorageEngineFactory(org.neo4j.storageengine.api.StorageEngineFactory) StoreFilesDiagnostics(org.neo4j.kernel.diagnostics.providers.StoreFilesDiagnostics) DatabaseLayout(org.neo4j.io.layout.DatabaseLayout) Neo4jLayout(org.neo4j.io.layout.Neo4jLayout) Test(org.junit.jupiter.api.Test)

Example 2 with StoreFilesDiagnostics

use of org.neo4j.kernel.diagnostics.providers.StoreFilesDiagnostics in project neo4j by neo4j.

the class KernelDiagnosticsOfflineReportProvider method listDataDirectory.

/**
 * Print a tree view of all the files in the database directory with files sizes.
 *
 * @param sources destination of the sources.
 */
private void listDataDirectory(List<DiagnosticsReportSource> sources) {
    StorageEngineFactory storageEngineFactory = StorageEngineFactory.defaultStorageEngine();
    StoreFilesDiagnostics storeFiles = new StoreFilesDiagnostics(storageEngineFactory, fs, databaseLayout);
    List<String> files = new ArrayList<>();
    storeFiles.dump(files::add);
    sources.add(DiagnosticsReportSources.newDiagnosticsString("tree.txt", () -> String.join(System.lineSeparator(), files)));
}
Also used : StorageEngineFactory(org.neo4j.storageengine.api.StorageEngineFactory) StoreFilesDiagnostics(org.neo4j.kernel.diagnostics.providers.StoreFilesDiagnostics) ArrayList(java.util.ArrayList)

Aggregations

StoreFilesDiagnostics (org.neo4j.kernel.diagnostics.providers.StoreFilesDiagnostics)2 StorageEngineFactory (org.neo4j.storageengine.api.StorageEngineFactory)2 ArrayList (java.util.ArrayList)1 Test (org.junit.jupiter.api.Test)1 GraphDatabaseSettings (org.neo4j.configuration.GraphDatabaseSettings)1 DatabaseLayout (org.neo4j.io.layout.DatabaseLayout)1 Neo4jLayout (org.neo4j.io.layout.Neo4jLayout)1