vzhikserg commented on a change in pull request #1949: [bookie-gc] add option
to cache entry-log metadata map into rocksDB
URL: https://github.com/apache/bookkeeper/pull/1949#discussion_r307051691
##########
File path:
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java
##########
@@ -323,54 +333,60 @@ public void runWithFlags(boolean force, boolean
suspendMajor, boolean suspendMin
// Recover and clean up previous state if using transactional
compaction
compactor.cleanUpAndRecover();
- // Extract all of the ledger ID's that comprise all of the entry logs
- // (except for the current new one which is still being written to).
- entryLogMetaMap = extractMetaFromEntryLogs(entryLogMetaMap);
+ try {
+ // Extract all of the ledger ID's that comprise all of the entry
+ // logs
+ // (except for the current new one which is still being written
to).
+ extractMetaFromEntryLogs();
- // gc inactive/deleted ledgers
- doGcLedgers();
+ // gc inactive/deleted ledgers
+ doGcLedgers();
- // gc entry logs
- doGcEntryLogs();
+ // gc entry logs
+ 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.");
- }
+ 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)) {
- // enter major compaction
- LOG.info("Enter major compaction, suspendMajor {}", suspendMajor);
- majorCompacting.set(true);
- doCompactEntryLogs(majorCompactionThreshold);
- lastMajorCompactionTime = System.currentTimeMillis();
- // and also move minor compaction time
- lastMinorCompactionTime = lastMajorCompactionTime;
- gcStats.getMajorCompactionCounter().inc();
- majorCompacting.set(false);
- } else if (enableMinorCompaction && (!suspendMinor)
- && (force || curTime - lastMinorCompactionTime >
minorCompactionInterval)) {
- // enter minor compaction
- LOG.info("Enter minor compaction, suspendMinor {}", suspendMinor);
- minorCompacting.set(true);
- doCompactEntryLogs(minorCompactionThreshold);
- lastMinorCompactionTime = System.currentTimeMillis();
- gcStats.getMinorCompactionCounter().inc();
- minorCompacting.set(false);
- }
+ long curTime = System.currentTimeMillis();
+ if (enableMajorCompaction && (!suspendMajor)
+ && (force || curTime - lastMajorCompactionTime >
majorCompactionInterval)) {
+ // enter major compaction
+ LOG.info("Enter major compaction, suspendMajor {}",
suspendMajor);
+ majorCompacting.set(true);
+ doCompactEntryLogs(majorCompactionThreshold);
+ lastMajorCompactionTime = System.currentTimeMillis();
+ // and also move minor compaction time
+ lastMinorCompactionTime = lastMajorCompactionTime;
+ gcStats.getMajorCompactionCounter().inc();
+ majorCompacting.set(false);
+ } else if (enableMinorCompaction && (!suspendMinor)
+ && (force || curTime - lastMinorCompactionTime >
minorCompactionInterval)) {
+ // enter minor compaction
+ LOG.info("Enter minor compaction, suspendMinor {}",
suspendMinor);
+ minorCompacting.set(true);
+ doCompactEntryLogs(minorCompactionThreshold);
+ lastMinorCompactionTime = System.currentTimeMillis();
+ gcStats.getMinorCompactionCounter().inc();
+ minorCompacting.set(false);
+ }
- 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());
+ if (force) {
Review comment:
Two if statements can be merged into one
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services