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/01/21 08:55:05 UTC
[bookkeeper] branch master updated: Small fix wrong
nodesUninitialized count when checkCovered
This is an automated email from the ASF dual-hosted git repository.
sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/master by this push:
new dcdd1e8 Small fix wrong nodesUninitialized count when checkCovered
dcdd1e8 is described below
commit dcdd1e887ef01f7515053f7eb06f8479de8700ff
Author: Huang,Dongfa <hu...@gmail.com>
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 <eo...@gmail.com>, Sijie Guo <si...@apache.org>
This closes #1900 from huangdongfa/fix-error-nodesUninitialized
---
.../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 45cd2eb..0a6d264 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
@@ -390,7 +390,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 = lh.getLedgerMetadata().getAllEnsembles().get(0L).get(1);