This is an automated email from the ASF dual-hosted git repository. chenhang pushed a commit to branch branch-4.14 in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
commit d51c86e6ee787f16bb910eae5f0f024e56d5bfe9 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 b4e6fc23e1..3299f70406 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); } }
