You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by si...@apache.org on 2019/04/19 00:32:41 UTC

[bookkeeper] branch branch-4.9 updated: Wait for LAC update even if ledger fenced

This is an automated email from the ASF dual-hosted git repository.

sijie pushed a commit to branch branch-4.9
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/branch-4.9 by this push:
     new a4724b4  Wait for LAC update even if ledger fenced
a4724b4 is described below

commit a4724b4f53517fc24c74a0804bb24736fbd49517
Author: Ivan Kelly <iv...@apache.org>
AuthorDate: Fri Apr 19 02:32:02 2019 +0200

    Wait for LAC update even if ledger fenced
    
    Previous behaviour was to return straight away. However, LAC can
    change when the ledger is fenced and there is no guarantee that a
    fenced ledger will turn into a closed ledger (fencing client may
    crash), which would cause the client tailing with longpoll LAC to go
    into a tight loop.
    
    
    Reviewers: Enrico Olivelli <eo...@gmail.com>, Jia Zhai <zh...@apache.org>, Matteo Merli <mm...@apache.org>, Venkateswararao Jujjuri (JV) <None>, Sijie Guo <si...@apache.org>
    
    This closes #2052 from ivankelly/wait-on-fenced
    
    (cherry picked from commit 316b71923e841c9fdb61159067c4bcf6075d1f21)
    Signed-off-by: Sijie Guo <si...@apache.org>
---
 .../src/main/java/org/apache/bookkeeper/bookie/FileInfo.java          | 3 +--
 .../org/apache/bookkeeper/bookie/storage/ldb/TransientLedgerInfo.java | 4 ++--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/FileInfo.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/FileInfo.java
index 656674f..f9bcd28 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/FileInfo.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/FileInfo.java
@@ -139,8 +139,7 @@ class FileInfo extends Watchable<LastAddConfirmedUpdateNotification> {
 
     synchronized boolean waitForLastAddConfirmedUpdate(long previousLAC,
                                                        Watcher<LastAddConfirmedUpdateNotification> watcher) {
-        if ((null != lac && lac > previousLAC)
-                || isClosed || ((stateBits & STATE_FENCED_BIT) == STATE_FENCED_BIT)) {
+        if ((null != lac && lac > previousLAC) || isClosed) {
             if (LOG.isTraceEnabled()) {
                 LOG.trace("Wait For LAC {} , {}", this.lac, previousLAC);
             }
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/TransientLedgerInfo.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/TransientLedgerInfo.java
index 27d63e8..91f3fbb 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/TransientLedgerInfo.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/TransientLedgerInfo.java
@@ -91,7 +91,7 @@ class TransientLedgerInfo extends Watchable<LastAddConfirmedUpdateNotification>
     synchronized boolean waitForLastAddConfirmedUpdate(long previousLAC,
             Watcher<LastAddConfirmedUpdateNotification> watcher) throws IOException {
         lastAccessed = System.currentTimeMillis();
-        if ((lac != NOT_ASSIGNED_LAC && lac > previousLAC) || isClosed || ledgerIndex.get(ledgerId).getFenced()) {
+        if ((lac != NOT_ASSIGNED_LAC && lac > previousLAC) || isClosed) {
             return false;
         }
 
@@ -153,4 +153,4 @@ class TransientLedgerInfo extends Watchable<LastAddConfirmedUpdateNotification>
         notifyWatchers(Long.MAX_VALUE);
     }
 
-}
\ No newline at end of file
+}