keith-turner closed pull request #759: Only requeue compaction when there was 
activity
URL: https://github.com/apache/accumulo/pull/759
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactionRunner.java
 
b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactionRunner.java
index 8fab78c4d6..8de7a9e9b3 100644
--- 
a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactionRunner.java
+++ 
b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactionRunner.java
@@ -41,12 +41,18 @@ public void run() {
       return;
     }
 
-    tablet.majorCompact(reason, queued);
+    CompactionStats stats = tablet.majorCompact(reason, queued);
 
-    // if there is more work to be done, queue another major compaction
-    synchronized (tablet) {
-      if (reason == MajorCompactionReason.NORMAL && 
tablet.needsMajorCompaction(reason))
-        tablet.initiateMajorCompaction(reason);
+    // Some compaction strategies may always return true for shouldCompact() 
because they need to
+    // make blocking calls to gather information. Without the following check 
these strategies would
+    // endlessly requeue. So only check if a subsequent compaction is needed 
if the previous
+    // compaction actually did something.
+    if (stats != null && stats.getEntriesRead() > 0) {
+      // if there is more work to be done, queue another major compaction
+      synchronized (tablet) {
+        if (reason == MajorCompactionReason.NORMAL && 
tablet.needsMajorCompaction(reason))
+          tablet.initiateMajorCompaction(reason);
+      }
     }
   }
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to