Source:
public void runWithFlags(boolean force, boolean suspendMajor, boolean suspendMinor) { long threadStart = MathUtils.nowInNano(); if (force) { LOG.info("Garbage collector thread forced to perform GC before expiry of wait time."); } compactor.cleanUpAndRecover(); entryLogMetaMap = extractMetaFromEntryLogs(entryLogMetaMap); doGcLedgers(); doGcEntryLogs(); if (suspendMajor) { LOG.info("Disk almost full, suspend major compaction to slow down filling disk."); } if (suspendMinor) { LOG.info("Disk full, suspend minor compaction to slow down filling disk."); } long curTime = System.currentTimeMillis(); if (enableMajorCompaction && (!suspendMajor) && (force || curTime - lastMajorCompactionTime > majorCompactionInterval)) { LOG.info("Enter major compaction, suspendMajor {}", suspendMajor); doCompactEntryLogs(majorCompactionThreshold); lastMajorCompactionTime = System.currentTimeMillis(); lastMinorCompactionTime = lastMajorCompactionTime; majorCompactionCounter.inc(); } else if (enableMinorCompaction && (!suspendMinor) && (force || curTime - lastMinorCompactionTime > minorCompactionInterval)) { LOG.info("Enter minor compaction, suspendMinor {}", suspendMinor); doCompactEntryLogs(minorCompactionThreshold); lastMinorCompactionTime = System.currentTimeMillis(); minorCompactionCounter.inc(); } if (force) { if (forceGarbageCollection.compareAndSet(true, false)) { LOG.info("{} Set forceGarbageCollection to true after force GC to make it forceGC-able again.", Thread .currentThread().getName()); } } this.gcThreadRuntime.registerSuccessfulEvent( MathUtils.nowInNano() - threadStart, TimeUnit.NANOSECONDS); }

Target:
public void runWithFlags(boolean force, boolean suspendMajor, boolean suspendMinor) { long threadStart = MathUtils.nowInNano(); if (force) { LOG.info("Garbage collector thread forced to perform GC before expiry of wait time."); } compactor.cleanUpAndRecover(); entryLogMetaMap = extractMetaFromEntryLogs(entryLogMetaMap); doGcLedgers(); doGcEntryLogs(); if (suspendMajor) { LOG.info("Disk almost full, suspend major compaction to slow down filling disk."); } if (suspendMinor) { LOG.info("Disk full, suspend minor compaction to slow down filling disk."); } long curTime = System.currentTimeMillis(); if (enableMajorCompaction && (!suspendMajor) && (force || curTime - lastMajorCompactionTime > majorCompactionInterval)) { LOG.info("Enter major compaction, suspendMajor {}", suspendMajor); doCompactEntryLogs(majorCompactionThreshold); lastMajorCompactionTime = System.currentTimeMillis(); lastMinorCompactionTime = lastMajorCompactionTime; majorCompactionCounter.inc(); } else if (enableMinorCompaction && (!suspendMinor) && (force || curTime - lastMinorCompactionTime > minorCompactionInterval)) { LOG.info("Enter minor compaction, suspendMinor {}", suspendMinor); doCompactEntryLogs(minorCompactionThreshold); lastMinorCompactionTime = System.currentTimeMillis(); minorCompactionCounter.inc(); } if (force) { if (forceGarbageCollection.compareAndSet(true, false)) { LOG.info("{} Set forceGarbageCollection to false after force GC to make it forceGC-able again.", Thread .currentThread().getName()); } } this.gcThreadRuntime.registerSuccessfulEvent( MathUtils.nowInNano() - threadStart, TimeUnit.NANOSECONDS); }