@Override public void run() { if ( labelScanStore instanceof NativeLabelScanStore ) { if ( ((NativeLabelScanStore)labelScanStore).isDirty() ) { reporter.report( new LabelScanIndex( labelScanStore.getLabelScanStoreFile() ), ConsistencyReport.LabelScanConsistencyReport.class, RecordType.LABEL_SCAN_DOCUMENT ).dirtyIndex(); } } } }
@Test void shouldCountAllIndexFiles() throws Exception { // Explicit index file File explicitIndex = testDirectory.databaseLayout().file( "explicitIndex" ); createFileOfSize( explicitIndex, 1 ); IndexImplementation indexImplementation = mock( IndexImplementation.class ); when( indexImplementation.getIndexImplementationDirectory( any() ) ).thenReturn( explicitIndex ); when( explicitIndexProviderLookup.allIndexProviders() ).thenReturn( iterable( indexImplementation ) ); // Schema index files File schemaIndex = testDirectory.databaseLayout().file( "schemaIndex" ); createFileOfSize( schemaIndex, 2 ); IndexDirectoryStructure directoryStructure = mock( IndexDirectoryStructure.class ); when( directoryStructure.rootDirectory() ).thenReturn( schemaIndex ); when( indexProvider.directoryStructure() ).thenReturn( directoryStructure ); File schemaIndex2 = testDirectory.databaseLayout().file( "schemaIndex2" ); createFileOfSize( schemaIndex2, 3 ); IndexDirectoryStructure directoryStructure2 = mock( IndexDirectoryStructure.class ); when( directoryStructure2.rootDirectory() ).thenReturn( schemaIndex2 ); when( indexProvider2.directoryStructure() ).thenReturn( directoryStructure2 ); // Label scan store File labelScan = testDirectory.databaseLayout().labelScanStore(); createFileOfSize( labelScan, 4 ); when( labelScanStore.getLabelScanStoreFile() ).thenReturn( labelScan ); // Count all files assertEquals( 10, storeSizeBean.getIndexStoreSize() ); }
@Override public long getIndexStoreSize() { long size = 0L; // Add explicit indices for ( IndexImplementation index : explicitIndexProviderLookup.allIndexProviders() ) { size += FileUtils.size( fs, index.getIndexImplementationDirectory( databaseLayout ) ); } // Add schema index MutableLong schemaSize = new MutableLong(); indexProviderMap.accept( provider -> { File rootDirectory = provider.directoryStructure().rootDirectory(); if ( rootDirectory != null ) { schemaSize.add( FileUtils.size( fs, rootDirectory ) ); } // else this provider didn't have any persistent storage } ); size += schemaSize.longValue(); // Add label index size += FileUtils.size( fs, labelScanStore.getLabelScanStoreFile() ); return size; }
when( labelScanStore.getLabelScanStoreFile() ).thenReturn( testDirectory.databaseLayout().labelScanStore() );
@Override public long getIndexStoreSize() { long size = 0L; // Add explicit indices for ( IndexImplementation index : explicitIndexProviderLookup.allIndexProviders() ) { size += FileUtils.size( fs, index.getIndexImplementationDirectory( databaseLayout ) ); } // Add schema index MutableLong schemaSize = new MutableLong(); indexProviderMap.accept( provider -> { File rootDirectory = provider.directoryStructure().rootDirectory(); if ( rootDirectory != null ) { schemaSize.add( FileUtils.size( fs, rootDirectory ) ); } // else this provider didn't have any persistent storage } ); size += schemaSize.longValue(); // Add label index size += FileUtils.size( fs, labelScanStore.getLabelScanStoreFile() ); return size; }