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

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


The following commit(s) were added to refs/heads/branch-4.8 by this push:
     new 2f507b0  Small fix wrong nodesUninitialized count when checkCovered
2f507b0 is described below

commit 2f507b0b4103e2272d1361a2bf12a018b23fd4a9
Author: Huang,Dongfa <[email protected]>
AuthorDate: Mon Jan 21 16:54:59 2019 +0800

    Small fix wrong nodesUninitialized count when checkCovered
    
    
    Descriptions of the changes in this PR:
    
    ### Motivation
    
    Since count `nodesUninitialized` is always 0,
    there is no wait if we haven't seen any OK responses and there are still 
nodes not heard from
    
    ### Changes
    
    Correct  nodesUninitialized count and add a related testcase
    
    
    
    
    Reviewers: Enrico Olivelli <[email protected]>, Sijie Guo 
<[email protected]>
    
    This closes #1900 from huangdongfa/fix-error-nodesUninitialized
    
    (cherry picked from commit dcdd1e887ef01f7515053f7eb06f8479de8700ff)
    Signed-off-by: Sijie Guo <[email protected]>
---
 .../bookkeeper/client/RoundRobinDistributionSchedule.java      |  5 +++--
 .../bookkeeper/client/RoundRobinDistributionScheduleTest.java  | 10 ++++++++++
 .../apache/bookkeeper/replication/BookieAutoRecoveryTest.java  |  2 +-
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/RoundRobinDistributionSchedule.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/RoundRobinDistributionSchedule.java
index d079408..a6506af 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/RoundRobinDistributionSchedule.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/RoundRobinDistributionSchedule.java
@@ -380,8 +380,9 @@ class RoundRobinDistributionSchedule implements 
DistributionSchedule {
                     } else if (covered[nodeIndex] != 
BKException.Code.NoSuchEntryException
                             && covered[nodeIndex] != 
BKException.Code.NoSuchLedgerExistsException) {
                         nodesNotCovered++;
-                    } else if (covered[nodeIndex] == 
BKException.Code.UNINITIALIZED) {
-                        nodesUninitialized++;
+                        if (covered[nodeIndex] == 
BKException.Code.UNINITIALIZED) {
+                            nodesUninitialized++;
+                        }
                     }
                 }
                 // if we haven't seen any OK responses and there are still 
nodes not heard from,
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/RoundRobinDistributionScheduleTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/RoundRobinDistributionScheduleTest.java
index b78f1ad..b78897a 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/RoundRobinDistributionScheduleTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/RoundRobinDistributionScheduleTest.java
@@ -73,6 +73,16 @@ public class RoundRobinDistributionScheduleTest {
             }
         }
         assertEquals("Should be no errors", 0, errors);
+
+        RoundRobinDistributionSchedule schedule = new 
RoundRobinDistributionSchedule(
+            5, 3, 5);
+        DistributionSchedule.QuorumCoverageSet covSet = 
schedule.getCoverageSet();
+        covSet.addBookie(0, BKException.Code.NoSuchLedgerExistsException);
+        covSet.addBookie(1, BKException.Code.NoSuchEntryException);
+        covSet.addBookie(2, BKException.Code.NoSuchLedgerExistsException);
+        covSet.addBookie(3, BKException.Code.UNINITIALIZED);
+        covSet.addBookie(4, BKException.Code.UNINITIALIZED);
+        assertFalse(covSet.checkCovered());
     }
 
     /**
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/replication/BookieAutoRecoveryTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/replication/BookieAutoRecoveryTest.java
index 4929b0e..845f221 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/replication/BookieAutoRecoveryTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/replication/BookieAutoRecoveryTest.java
@@ -395,7 +395,7 @@ public class BookieAutoRecoveryTest extends 
BookKeeperClusterTestCase {
         latch = new CountDownLatch(1);
         Stat s = watchUrLedgerNode(urZNode, latch); // should be marked as 
replicated
         if (s != null) {
-            assertTrue("Should be marked as replicated", latch.await(10, 
TimeUnit.SECONDS));
+            assertTrue("Should be marked as replicated", latch.await(15, 
TimeUnit.SECONDS));
         }
 
         replicaToKill = LedgerHandleAdapter

Reply via email to