sijie commented on a change in pull request #1397: Bookies should be from 
different racks in a Writequorum.
URL: https://github.com/apache/bookkeeper/pull/1397#discussion_r187251645
 
 

 ##########
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/RackawareEnsemblePlacementPolicyImpl.java
 ##########
 @@ -542,9 +544,58 @@ public void 
handleBookiesThatJoined(Set<BookieSocketAddress> joinedBookies) {
                         curRack = localNode.getNetworkLocation();
                     }
                 } else {
-                    curRack = "~" + prevNode.getNetworkLocation();
+                    StringBuilder sb = new StringBuilder();
+                    sb.append("~");
+
+                    if (writeQuorumSize > 1) {
+                        /*
+                         * Ideally RackAwareEnsemblePlacementPolicy should try
+                         * to select bookies from different racks for a write
+                         * quorum. So in a WriteQuorum, bookies should be from
+                         * WriteQuorum number of racks. So we would add racks 
of
+                         * (WriteQuorumSize-1) neighbours (both sides) to the
+                         * exclusion list (~curRack).
+                         */
+                        for (int j = 1; j < writeQuorumSize; j++) {
 
 Review comment:
   can we have a separate setting like `minNumRacksPerWriteQuorum` and by 
default set it to 2? so that it doesn't change the default behavior here.
   
   because not everyone has enough rack diversity. especially when running 
bookkeeper in cloud, we only can use `availability zone` as `rack`, so the 
number of `availability zone`s per region is typically limited to 2~3.

----------------------------------------------------------------
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

Reply via email to