This is an automated email from the ASF dual-hosted git repository.

sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new 0c9e88b  ISSUE #985: Add log messages to indicate bucket levels of 
entryLog.
0c9e88b is described below

commit 0c9e88be25d3a37300cffc518d25a79a49456d24
Author: JV <[email protected]>
AuthorDate: Fri Jan 19 01:08:55 2018 -0800

    ISSUE #985: Add log messages to indicate bucket levels of entryLog.
    
    (bug W-3333413)
    Signed-off-by: Venkateswararao Jujjuri (JV) <vjujjurisalesforce.com>
    [Fixed merge issues]
    Signed-off-by: Samuel Just <sjustsalesforce.com>
    
    Author: JV <[email protected]>
    
    Reviewers: Sijie Guo <[email protected]>, Venkateswararao Jujjuri (JV) <None>
    
    This closes #997 from athanatos/forupstream/logs1/compaction, closes #985
---
 .../apache/bookkeeper/bookie/GarbageCollectorThread.java    | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java
index e479a2a..4880fa3 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java
@@ -432,9 +432,17 @@ public class GarbageCollectorThread extends SafeRunnable {
         logsToCompact.addAll(entryLogMetaMap.values());
         logsToCompact.sort(Comparator.comparing(EntryLogMetadata::getUsage));
 
+        final int numBuckets = 10;
+        int entryLogUsageBuckets[] = new int[numBuckets];
+
         for (EntryLogMetadata meta : logsToCompact) {
+            int bucketIndex = Math.min(
+                    numBuckets - 1,
+                    (int) Math.ceil(meta.getUsage() * numBuckets));
+            entryLogUsageBuckets[bucketIndex]++;
+
             if (meta.getUsage() >= threshold) {
-                break;
+                continue;
             }
             if (LOG.isDebugEnabled()) {
                 LOG.debug("Compacting entry log {} below threshold {}", 
meta.getEntryLogId(), threshold);
@@ -448,6 +456,9 @@ public class GarbageCollectorThread extends SafeRunnable {
                 return;
             }
         }
+        LOG.info(
+                "Compaction: entry log usage buckets[10% 20% 30% 40% 50% 60% 
70% 80% 90% 100%] = {}",
+                entryLogUsageBuckets);
     }
 
     /**

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to