eolivelli commented on a change in pull request #887: make replaceBookie()
exclude ensemble bookie racks
URL: https://github.com/apache/bookkeeper/pull/887#discussion_r157720754
##########
File path:
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/RackawareEnsemblePlacementPolicyImpl.java
##########
@@ -594,8 +608,57 @@ public BookieNode selectFromNetworkLocation(
}
}
- protected String getRemoteRack(BookieNode node) {
- return "~" + node.getNetworkLocation();
+ protected BookieNode selectFromNetworkLocation(String networkLoc,
+ Set<String> excludeRacks,
+ Set<Node> excludeBookies,
+ Predicate<BookieNode>
predicate,
+ Ensemble<BookieNode>
ensemble)
+ throws BKNotEnoughBookiesException {
+ // first attempt to select one from local rack
+ try {
+ return selectRandomFromRack(networkLoc, excludeBookies, predicate,
ensemble);
+ } catch (BKNotEnoughBookiesException e) {
+ if (isWeighted) {
+ // if weight based selection is enabled, randomly select one
from the whole cluster
+ // based on weights and ignore the provided predicate.
Review comment:
"ignore the provided predicate" -> maybe the comment is wrong ? it seems to
me that the predicate is applied in selectRandom
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services