This is an automated email from the ASF dual-hosted git repository. yong pushed a commit to branch branch-4.15 in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
commit 7808d1fcc4bffe6eb3acb3fc390d9e1c5e9eb19b Author: erobot <[email protected]> AuthorDate: Mon Dec 4 11:46:02 2023 +0800 Fix a slow gc thread shutdown when compacting (#4127) Descriptions of the changes in this PR: ### Motivation Fix a slow gc thread shutdown when compacting. The problem here is that the stop flag `running` has been moved after `compacting.compareAndSet`. When `running` is not set to false, entry log continues to compact one after one and the shutdown thread is hard to set the `compacting`. ### Changes Set `running` to false first and then check `compacting`. Master Issue: #4126 (cherry picked from commit a842f3e92cbe7c9a99f72567af19b8f7c4ce7e82) --- .../main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java | 2 +- 1 file changed, 1 insertion(+), 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 40a007dcd5..2a0d794b5b 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 @@ -670,6 +670,7 @@ public class GarbageCollectorThread extends SafeRunnable { if (!this.running) { return; } + this.running = false; LOG.info("Shutting down GarbageCollectorThread"); throttler.cancelledAcquire(); @@ -679,7 +680,6 @@ public class GarbageCollectorThread extends SafeRunnable { Thread.sleep(100); } - this.running = false; // Interrupt GC executor thread gcExecutor.shutdownNow(); try {
