bookkeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From si...@apache.org
Subject bookkeeper git commit: BOOKKEEPER-840: Deadlock on flushLock on compaction (sijie)
Date Wed, 18 Mar 2015 05:40:42 GMT
Repository: bookkeeper
Updated Branches:
  refs/heads/branch-4.3 4d217faea -> 0802d1503


BOOKKEEPER-840: Deadlock on flushLock on compaction (sijie)


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

Branch: refs/heads/branch-4.3
Commit: 0802d15033f15082104239971bca45108a8b00e9
Parents: 4d217fa
Author: Sijie Guo <sijie@apache.org>
Authored: Tue Mar 17 22:40:30 2015 -0700
Committer: Sijie Guo <sijie@apache.org>
Committed: Tue Mar 17 22:40:30 2015 -0700

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 ++
 .../bookie/GarbageCollectorThread.java          | 23 ++++++++++----------
 2 files changed, 14 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/0802d150/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index e1c7c9c..d0414a4 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -22,6 +22,8 @@ Release 4.3.1 - unreleased
 
       BOOKKEEPER-839: AuditorPeriodicCheckTest timeout (rakeshr via sijie)
 
+      BOOKKEEPER-840: Deadlock on flushLock on compaction (sijie)
+
     IMPROVEMENTS:
 
       BOOKKEEPER-800: Expose whether a ledger is closed or not (ivank)

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/0802d150/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 74c6ec2..86d2a66 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
@@ -140,7 +140,7 @@ public class GarbageCollectorThread extends BookieThread {
             };
         }
 
-        Object flushLock = new Object();
+        final Object flushLock = new Object();
 
         @Override
         public void onRotateEntryLog() {
@@ -155,18 +155,19 @@ public class GarbageCollectorThread extends BookieThread {
                     LOG.debug("Skipping entry log flushing, as there is no offset!");
                     return;
                 }
-                synchronized (flushLock) {
-                    Offset lastOffset = offsets.get(offsets.size()-1);
-                    long lastOffsetLogId = EntryLogger.logIdForOffset(lastOffset.offset);
-                    while (lastOffsetLogId < entryLogger.getLeastUnflushedLogId() &&
running) {
-                        flushLock.wait(1000);
 
-                        lastOffset = offsets.get(offsets.size()-1);
-                        lastOffsetLogId = EntryLogger.logIdForOffset(lastOffset.offset);
-                    }
-                    if (lastOffsetLogId >= entryLogger.getLeastUnflushedLogId() &&
!running) {
-                        throw new IOException("Shutdown before flushed");
+                Offset lastOffset = offsets.get(offsets.size()-1);
+                long lastOffsetLogId = EntryLogger.logIdForOffset(lastOffset.offset);
+                while (lastOffsetLogId < entryLogger.getLeastUnflushedLogId() &&
running) {
+                    synchronized (flushLock) {
+                        flushLock.wait(1000);
                     }
+
+                    lastOffset = offsets.get(offsets.size()-1);
+                    lastOffsetLogId = EntryLogger.logIdForOffset(lastOffset.offset);
+                }
+                if (lastOffsetLogId >= entryLogger.getLeastUnflushedLogId() &&
!running) {
+                    throw new IOException("Shutdown before flushed");
                 }
             } catch (InterruptedException ie) {
                 Thread.currentThread().interrupt();


Mime
View raw message