You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ns...@apache.org on 2011/10/11 04:04:04 UTC

svn commit: r1181384 - /hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java

Author: nspiegelberg
Date: Tue Oct 11 02:04:04 2011
New Revision: 1181384

URL: http://svn.apache.org/viewvc?rev=1181384&view=rev
Log:
avoid log spew for regions already in compaction queue

Summary:
We were debug logging compaction requests even in cases the region was already
in queue.

Small diff to only report when the region is *actually* added to the compaction
queue. Also now print the pending compaction queue whenever a compaction is
completed.

Test Plan:
* run on cluster and check the new messages.
* kicked off unit test suite run in the background.

DiffCamp Revision: 162055
Reviewed By: nspiegelberg
CC: jgray, nspiegelberg, kannan, kranganathan
Revert Plan:
OK

Modified:
    hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java

Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java?rev=1181384&r1=1181383&r2=1181384&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java (original)
+++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java Tue Oct 11 02:04:04 2011
@@ -68,7 +68,6 @@ class CompactSplitThread extends Thread 
 
   @Override
   public void run() {
-    int count = 0;
     while (!this.server.isStopRequested()) {
       HRegion r = null;
       try {
@@ -81,6 +80,9 @@ class CompactSplitThread extends Thread 
           try {
             // Don't interrupt us while we are working
             byte [] midKey = r.compactStores();
+            LOG.debug("Just finished a compaction. " +
+                      " Current Compaction Queue Size: " +
+                      getCompactionQueueSize());
             if (midKey != null && !this.server.isStopRequested()) {
               split(r, midKey);
             }
@@ -127,22 +129,29 @@ class CompactSplitThread extends Thread 
    */
   public synchronized void compactionRequested(final HRegion r,
       final boolean force, final String why) {
+
+    boolean addedToQueue = false;
+
     if (this.server.stopRequested.get()) {
       return;
     }
+
     r.setForceMajorCompaction(force);
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("Compaction " + (force? "(major) ": "") +
-        "requested for region " + r.getRegionNameAsString() +
-        "/" + r.getRegionInfo().getEncodedName() +
-        (why != null && !why.isEmpty()? " because: " + why: ""));
-    }
     synchronized (regionsInQueue) {
       if (!regionsInQueue.contains(r)) {
         compactionQueue.add(r);
         regionsInQueue.add(r);
+        addedToQueue = true;
       }
     }
+
+    // only log if actually added to compaction queue...
+    if (addedToQueue && LOG.isDebugEnabled()) {
+      LOG.debug("Compaction " + (force? "(major) ": "") +
+        "requested for region " + r.getRegionNameAsString() +
+        "/" + r.getRegionInfo().getEncodedName() +
+        (why != null && !why.isEmpty()? " because: " + why: ""));
+    }
   }
 
   private void split(final HRegion region, final byte [] midKey)