@Test public void handlesNoLiveValuesIfNoLiveValueInOplog() { when(compactor.keepCompactorRunning()).thenReturn(true); doReturn(true).when(oplog).hasNoLiveValues(); assertThat(oplog.compact(compactor)).isEqualTo(0); verify(oplog, times(1)).handleNoLiveValues(); }
@Test public void invockeCleanupAfterCompaction() { when(compactor.keepCompactorRunning()).thenReturn(true); doReturn(mock(DiskStoreStats.class)).when(oplog).getStats(); doReturn(false).when(oplog).hasNoLiveValues(); oplog.compact(compactor); verify(oplog, times(1)).cleanupAfterCompaction(eq(false)); }
private void basicAddToBeCompacted(Oplog oplog) { if (!oplog.isRecovering() && oplog.hasNoLiveValues()) { oplog.cancelKrf(); oplog.close(); // fix for bug 41687 oplog.deleteFiles(oplog.getHasDeletes()); } else { int inactivePromotedCount = 0; parent.getStats().incCompactableOplogs(1); Long key = Long.valueOf(oplog.getOplogId()); synchronized (this.oplogIdToOplog) { if (this.inactiveOplogs.remove(key) != null) { if (oplog.isRAFOpen()) { inactiveOpenCount.decrementAndGet(); } inactivePromotedCount++; } this.oplogIdToOplog.put(key, oplog); } if (inactivePromotedCount > 0) { parent.getStats().incInactiveOplogs(-inactivePromotedCount); } } }
if (this.crf.f != null && !hasNoLiveValues()) { this.closed = false; getParent()); if (hasNoLiveValues() && !offline) { getOplogSet().removeOplog(getOplogId(), true, getHasDeletes() ? this : null); if (!getHasDeletes()) {
void handleNoLiveValues() { if (!this.doneAppending) return; if (hasNoLiveValues()) { if (LocalRegion.ISSUE_CALLBACKS_TO_CACHE_OBSERVER) { if (calledByCompactorThread()) {
if (hasNoLiveValues()) { handleNoLiveValues(); return 0; // do this while holding compactorLock
if (calledByCompactor && emptyOplog.hasNoLiveValues()) {