athanatos commented on a change in pull request #1810: Remove duplication logic 
for 'minNumRacksPerWriteQuorum' handling in RackawareEnsemblePlacementPolicyImpl
URL: https://github.com/apache/bookkeeper/pull/1810#discussion_r233648071
 
 

 ##########
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/RackawareEnsemblePlacementPolicyImpl.java
 ##########
 @@ -566,64 +564,11 @@ public void 
handleBookiesThatJoined(Set<BookieSocketAddress> joinedBookies) {
                         curRack = localNode.getNetworkLocation();
                     }
                 } else {
-                    StringBuilder sb = new StringBuilder();
-                    sb.append("~");
-
-                    if (writeQuorumSize > 1) {
-                        /*
-                         * RackAwareEnsemblePlacementPolicy should try to 
select
-                         * bookies from atleast
-                         * minNumRacksPerWriteQuorumForThisEnsemble number of
-                         * different racks for a write quorum. So in a
-                         * WriteQuorum, bookies should be from
-                         * minNumRacksPerWriteQuorumForThisEnsemble number of
-                         * racks. So we would add racks of
-                         * (minNumRacksPerWriteQuorumForThisEnsemble-1)
-                         * neighbours (both sides) to the exclusion list
-                         * (~curRack).
-                         */
-                        for (int j = 1; j < 
minNumRacksPerWriteQuorumForThisEnsemble; j++) {
-                            int nextIndex = i + j;
-                            if (nextIndex >= ensembleSize) {
-                                nextIndex %= ensembleSize;
-                            }
-                            /*
-                             * if racks[nextIndex] is null, then it means 
bookie
-                             * is not yet selected for ensemble at 'nextIndex'
-                             * index.
-                             */
-                            if (racks[nextIndex] != null) {
-                                if (!((sb.length() == 1) && (sb.charAt(0) == 
'~'))) {
-                                    
sb.append(NetworkTopologyImpl.NODE_SEPARATOR);
-                                }
-                                sb.append(racks[nextIndex]);
-                            }
-                        }
-
-                        for (int j = 1; j < 
minNumRacksPerWriteQuorumForThisEnsemble; j++) {
-                            int nextIndex = i - j;
-                            if (nextIndex < 0) {
-                                nextIndex += ensembleSize;
-                            }
-                            /*
-                             * if racks[nextIndex] is null, then it means 
bookie
-                             * is not yet selected for ensemble at 'nextIndex'
-                             * index.
-                             */
-                            if (racks[nextIndex] != null) {
-                                if (!((sb.length() == 1) && (sb.charAt(0) == 
'~'))) {
-                                    
sb.append(NetworkTopologyImpl.NODE_SEPARATOR);
-                                }
-                                sb.append(racks[nextIndex]);
-                            }
-                        }
-                    }
-                    curRack = sb.toString();
+                    curRack = "~" + prevNode.getNetworkLocation();
 
 Review comment:
   I'm actually not even sure this part is necessary.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to