nativeLabelScanStore.shutdown();
private void createDirtyIndex( PageCache pageCache ) throws IOException { NativeLabelScanStore nativeLabelScanStore = null; try { nativeLabelScanStore = new NativeLabelScanStore( pageCache, testDirectory.databaseLayout(), fileSystemRule.get(), THROWING_STREAM, false, new Monitors(), immediate() ); nativeLabelScanStore.init(); nativeLabelScanStore.start(); } catch ( IllegalArgumentException e ) { if ( nativeLabelScanStore != null ) { nativeLabelScanStore.shutdown(); } } }
@Test public void labelScanStoreIsDirtyWhenIndexIsNotClean() throws IOException { PageCache pageCache = pageCacheRule.getPageCache( fileSystemRule.get() ); createDirtyIndex( pageCache ); Monitors monitors = new Monitors(); RecordingMonitor monitor = new RecordingMonitor(); monitors.addMonitorListener( monitor ); NativeLabelScanStore nativeLabelScanStore = new NativeLabelScanStore( pageCache, testDirectory.databaseLayout(), fileSystemRule.get(), EMPTY, true, monitors, ignore() ); nativeLabelScanStore.init(); nativeLabelScanStore.start(); assertTrue( nativeLabelScanStore.isDirty() ); nativeLabelScanStore.shutdown(); }
@Test public void doNotRebuildIfOpenedInReadOnlyModeAndIndexIsNotClean() throws IOException { PageCache pageCache = pageCacheRule.getPageCache( fileSystemRule.get() ); createDirtyIndex( pageCache ); Monitors monitors = new Monitors(); RecordingMonitor monitor = new RecordingMonitor(); monitors.addMonitorListener( monitor ); NativeLabelScanStore nativeLabelScanStore = new NativeLabelScanStore( pageCache, testDirectory.databaseLayout(), fileSystemRule.get(), EMPTY, true, monitors, ignore() ); nativeLabelScanStore.init(); nativeLabelScanStore.start(); assertTrue( monitor.notValid ); assertFalse( monitor.rebuilt ); assertFalse( monitor.rebuilding ); nativeLabelScanStore.shutdown(); }
@Test public void mustBeDirtyIfFailedDuringRebuild() throws Exception { // given PageCache pageCache = pageCacheRule.getPageCache( fileSystemRule.get() ); createDirtyIndex( pageCache ); // when RecordingMonitor monitor = new RecordingMonitor(); Monitors monitors = new Monitors(); monitors.addMonitorListener( monitor ); NativeLabelScanStore nativeLabelScanStore = new NativeLabelScanStore( pageCache, testDirectory.databaseLayout(), fileSystemRule.get(), EMPTY, false, monitors, immediate() ); nativeLabelScanStore.init(); nativeLabelScanStore.start(); // then assertTrue( monitor.notValid ); assertTrue( monitor.rebuilding ); assertTrue( monitor.rebuilt ); nativeLabelScanStore.shutdown(); }