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:23:50 GMT
Repository: bookkeeper
Updated Branches:
  refs/heads/master f2928dca4 -> 68c5b5a40


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/68c5b5a4
Tree: http://git-wip-us.apache.org/repos/asf/bookkeeper/tree/68c5b5a4
Diff: http://git-wip-us.apache.org/repos/asf/bookkeeper/diff/68c5b5a4

Branch: refs/heads/master
Commit: 68c5b5a40c33b813482e8a2371eedcb2e0d224e8
Parents: f2928dc
Author: Sijie Guo <sijie@apache.org>
Authored: Tue Mar 17 22:23:37 2015 -0700
Committer: Sijie Guo <sijie@apache.org>
Committed: Tue Mar 17 22:23:37 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/68c5b5a4/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 0337185..e24aa40 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -32,6 +32,8 @@ Trunk (unreleased changes)
 
       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/68c5b5a4/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 a1f044f..299fb3e 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
@@ -168,7 +168,7 @@ public class GarbageCollectorThread extends BookieThread {
             };
         }
 
-        Object flushLock = new Object();
+        final Object flushLock = new Object();
 
         @Override
         public void onRotateEntryLog() {
@@ -183,18 +183,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