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

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


The following commit(s) were added to refs/heads/branch-4.15 by this push:
     new 73b0b9fb28 Add logs for ensemble select failed (#3779)
73b0b9fb28 is described below

commit 73b0b9fb28f703ec584531478b459069b170f3fd
Author: Hang Chen <[email protected]>
AuthorDate: Wed Feb 22 09:08:19 2023 +0800

    Add logs for ensemble select failed (#3779)
    
    ### Motivation
    We have 3 bookies in the same rack, and configured `E = 2, W = 2, A = 2`. 
When one bookie restarted, we found the ledger select bookie from the same rack 
failed in the ensemble change replacing the failed bookie step.
    
    Due to there being no log information in `selectRandomFromRack`, it's hard 
to debug the root cause.
    
https://github.com/apache/bookkeeper/blob/02e64a4b97e03afc9993ab227f82a5956965c03f/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/RackawareEnsemblePlacementPolicyImpl.java#L630-L679
    
    ### Modification
    Add one warn log in `selectRandomFromRack` when selecting a new bookie node 
failed.
    
    (cherry picked from commit 9ff295443097cc85903d8d9f0319ec582fb601bf)
---
 .../client/RackawareEnsemblePlacementPolicyImpl.java          | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/RackawareEnsemblePlacementPolicyImpl.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/RackawareEnsemblePlacementPolicyImpl.java
index 0461e21b9a..8fed575543 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/RackawareEnsemblePlacementPolicyImpl.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/RackawareEnsemblePlacementPolicyImpl.java
@@ -531,9 +531,10 @@ public class RackawareEnsemblePlacementPolicyImpl extends 
TopologyAwareEnsembleP
                         networkLoc, excludeBookies);
                 throw e;
             }
-            LOG.warn("Failed to choose a bookie from {} : "
-                     + "excluded {}, fallback to choose bookie randomly from 
the cluster.",
-                     networkLoc, excludeBookies);
+            LOG.warn("Failed to choose a bookie from network location {}, "
+                    + "the bookies in the network location are {}, excluded 
bookies {}, "
+                    + "current ensemble {}, fallback to choose bookie randomly 
from the cluster.",
+                     networkLoc, topology.getLeaves(networkLoc), 
excludeBookies, ensemble);
             // randomly choose one from whole cluster, ignore the provided 
predicate.
             return selectRandom(1, excludeBookies, predicate, ensemble).get(0);
         }
@@ -556,6 +557,10 @@ public class RackawareEnsemblePlacementPolicyImpl extends 
TopologyAwareEnsembleP
              * the whole cluster and exclude the racks specified at
              * <tt>excludeRacks</tt>.
              */
+            LOG.warn("Failed to choose a bookie node from network location {}, 
"
+                    + "the bookies in the network location are {}, excluded 
bookies {}, "
+                    + "current ensemble {}, fallback to choose bookie randomly 
from the cluster.",
+                networkLoc, topology.getLeaves(networkLoc), excludeBookies, 
ensemble);
             return selectFromNetworkLocation(excludeRacks, excludeBookies, 
predicate, ensemble, fallbackToRandom);
         }
     }

Reply via email to