hangc0276 commented on code in PR #4384:
URL: https://github.com/apache/bookkeeper/pull/4384#discussion_r1614985907


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java:
##########
@@ -649,9 +666,11 @@ void doCompactEntryLogs(double threshold, long 
maxTimeMillis) throws EntryLogMet
                 LOG.debug("Compaction ran for {}ms but was limited by {}ms", 
timeDiff, maxTimeMillis);
             }
         }
-        LOG.info(
-                "Compaction: entry log usage buckets[10% 20% 30% 40% 50% 60% 
70% 80% 90% 100%] = {}, compacted {}",
-                entryLogUsageBuckets, compactedBuckets);
+        int totalEntryLogNum = Arrays.stream(entryLogUsageBuckets).sum();
+        int compactedEntryLogNum = Arrays.stream(compactedBuckets).sum();
+        this.entryLogCompactRatio = totalEntryLogNum == 0 ? 0 : (double) 
compactedEntryLogNum / totalEntryLogNum;

Review Comment:
   I suggest exposing the whole bucket statistics to metrics instead of a 
ratio. It will be more helpful for debugging the bookie ledger disk usage not 
cleaning up the issue. You can refer to Pulsar `pulsar_ml_EntrySizeBuckets` 
metrics 
   https://pulsar.apache.org/docs/3.2.x/reference-metrics/#managedledger-metrics



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to