Repository: bookkeeper
Updated Branches:
  refs/heads/master 61a5446b8 -> 1a2e017b6


BOOKKEEPER-1051: Fast shutdown for GarbageCollectorThread

Several unit tests are taking very long time to complete (eg: 
`BookieLedgerIndexTest` taking ~10 minutes).
The reason is that these tests are playing with the ZK quorum shutting it down 
and after the test succeeds, the shutdown phase is taking long time, since we 
try to do graceful shutdown with 1min wait time.
I think is better to interrupt immediately the garbage collector thread when 
shutting down the bookie.

Author: Matteo Merli <[email protected]>

Reviewers: Enrico Olivelli <None>

Closes #141 from merlimat/fast-gc-thread-shutdown


Project: http://git-wip-us.apache.org/repos/asf/bookkeeper/repo
Commit: http://git-wip-us.apache.org/repos/asf/bookkeeper/commit/1a2e017b
Tree: http://git-wip-us.apache.org/repos/asf/bookkeeper/tree/1a2e017b
Diff: http://git-wip-us.apache.org/repos/asf/bookkeeper/diff/1a2e017b

Branch: refs/heads/master
Commit: 1a2e017b65812e6e50975213a365aa37eba9fa96
Parents: 61a5446
Author: Matteo Merli <[email protected]>
Authored: Tue May 9 14:06:02 2017 -0700
Committer: Matteo Merli <[email protected]>
Committed: Tue May 9 14:06:02 2017 -0700

----------------------------------------------------------------------
 .../org/apache/bookkeeper/bookie/GarbageCollectorThread.java | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/1a2e017b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java
----------------------------------------------------------------------
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 f4b35f8..b524b21 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
@@ -487,11 +487,9 @@ public class GarbageCollectorThread extends SafeRunnable {
             // Wait till the thread stops compacting
             Thread.sleep(100);
         }
-        gcExecutor.shutdown();
-        if (gcExecutor.awaitTermination(60, TimeUnit.SECONDS)) {
-            LOG.warn("GC executor did not shut down in 60 seconds. Killing");
-            gcExecutor.shutdownNow();
-        }
+
+        // Interrupt GC executor thread
+        gcExecutor.shutdownNow();
     }
 
     /**

Reply via email to