ivankelly commented on a change in pull request #776: Issue 709: Add Slow 
Bookkeeper Servers to Placement Policy for read ordering
URL: https://github.com/apache/bookkeeper/pull/776#discussion_r156067695
 
 

 ##########
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerHandle.java
 ##########
 @@ -310,6 +313,29 @@ DistributionSchedule getDistributionSchedule() {
         return distributionSchedule;
     }
 
+    /**
+     * Generate the health info for bookies in the write set.
+     *
+     * @return BookiesHealthInfo for every bookie in the write set.
+     */
+    public BookiesHealthInfo generateHealthInfoForWriteSet(
 
 Review comment:
   This is very allocatey for something that runs for every read request. It 
allocates a new map for bookiePendingMap, and converts bookieFailureHistory 
into a map, and allocates a new BookiesHealthInfo object, but all of these are 
just references to info elsewhere in the client. 
   
   Instead of this, we can have BookiesHealthInfo as a interface, and have a 
member field in LedgerHandle or BookKeeper.
   
   ```
   final BookiesHealthInfo bookieHealthInfo = new BookiesHealthInfo() {
       @Override
       public long getBookieFailureHistory(BookieSocketAddress 
bookieSocketAddress) {
           Long lastFailure = 
bookieFailureHistory.getIfPresent(bookieSocketAddress);
           return lastFailure == null ? -1L : lastFailure;
       }
   
       @Override
       public int getBookiePendingRequests(BookieSocketAddress 
bookieSocketAddress) {
           PerChannelBookieClientPool pcbcPool = client.lookupClient(address);
           return pcbcPool == null ? 0 : 
pcbcPool.getNumPendingCompletionRequests();
      }
   }
   ```

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