This is an automated email from the ASF dual-hosted git repository.
sijie pushed a commit to branch branch-4.10
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/branch-4.10 by this push:
new 6abe13c Do not log WARNING about PlacementPolicy for tests and simple
setups
6abe13c is described below
commit 6abe13cc4dba1c8c7b9c1a1bf20e1ebdf5cb54a4
Author: Enrico Olivelli <[email protected]>
AuthorDate: Thu Mar 19 00:10:18 2020 +0100
Do not log WARNING about PlacementPolicy for tests and simple setups
Descriptions of the changes in this PR:
Do not log 'New ensemble: {} is not adhering to Placement Policy.
quarantinedBookies' in case of ensembleSize = 1
### Motivation
In tests cases and in simple demos it is very annoying to see that log line
at "WARNING" level.
If we are requiring only 1 bookie it is not a big deal to WARN that the
placement policy is not "adhering"
Reviewers: Matteo Minardi <[email protected]>, Atri Sharma <None>,
Sijie Guo <None>
This closes #2286 from eolivelli/fix/no-log-single-bookie
(cherry picked from commit 05fe83d6ca97d6bc415bb304e4f24537b7b06c0a)
Signed-off-by: Sijie Guo <[email protected]>
---
.../main/java/org/apache/bookkeeper/client/BookieWatcherImpl.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookieWatcherImpl.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookieWatcherImpl.java
index e38dcf6..f18799c 100644
---
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookieWatcherImpl.java
+++
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookieWatcherImpl.java
@@ -238,7 +238,7 @@ class BookieWatcherImpl implements BookieWatcher {
long startTime = MathUtils.nowInNano();
EnsemblePlacementPolicy.PlacementResult<List<BookieSocketAddress>>
newEnsembleResponse;
List<BookieSocketAddress> socketAddresses;
- PlacementPolicyAdherence isEnsembleAdheringToPlacementPolicy =
PlacementPolicyAdherence.FAIL;
+ PlacementPolicyAdherence isEnsembleAdheringToPlacementPolicy;
try {
Set<BookieSocketAddress> quarantinedBookiesSet =
quarantinedBookies.asMap().keySet();
newEnsembleResponse = placementPolicy.newEnsemble(ensembleSize,
writeQuorumSize, ackQuorumSize,
@@ -247,8 +247,10 @@ class BookieWatcherImpl implements BookieWatcher {
isEnsembleAdheringToPlacementPolicy =
newEnsembleResponse.isAdheringToPolicy();
if (isEnsembleAdheringToPlacementPolicy ==
PlacementPolicyAdherence.FAIL) {
ensembleNotAdheringToPlacementPolicy.inc();
- log.warn("New ensemble: {} is not adhering to Placement
Policy. quarantinedBookies: {}",
- socketAddresses, quarantinedBookiesSet);
+ if (ensembleSize > 1) {
+ log.warn("New ensemble: {} is not adhering to Placement
Policy. quarantinedBookies: {}",
+ socketAddresses, quarantinedBookiesSet);
+ }
}
// we try to only get from the healthy bookies first
newEnsembleTimer.registerSuccessfulEvent(MathUtils.nowInNano() -
startTime, TimeUnit.NANOSECONDS);