wenbingshen commented on code in PR #4324:
URL: https://github.com/apache/bookkeeper/pull/4324#discussion_r1584628564
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/RackawareEnsemblePlacementPolicyImpl.java:
##########
@@ -792,9 +792,6 @@ protected List<BookieNode>
selectRandomInternal(List<BookieNode> bookiesToSelect
Map<BookieNode, WeightedObject> rackMap = new HashMap<BookieNode,
WeightedObject>();
for (BookieNode n : bookiesToSelectFrom) {
- if (excludeBookies.contains(n)) {
- continue;
- }
Review Comment:
```java
Set<BookieNode> bookiesSeenSoFar = new HashSet<BookieNode>();
int beforeExcludeBookiesSize = excludeBookies.size();
while (numBookies > 0) {
if (isWeighted) {
if ((bookiesSeenSoFar.size() + beforeExcludeBookiesSize) ==
bookiesToSelectFrom.size()) {
// If we have gone through the whole available list of
bookies,
// and yet haven't been able to satisfy the ensemble
request, bail out.
// We don't want to loop infinitely.
break;
}
bookie = wRSelection.getNextRandom();
bookiesSeenSoFar.add(bookie);
} else {
```
Can we use this change `(bookiesSeenSoFar.size() + beforeExcludeBookiesSize)
== bookiesToSelectFrom.size()` to reduce the selection of already excluded
bookies?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]