horizonzy opened a new pull request, #4009:
URL: https://github.com/apache/bookkeeper/pull/4009

   Descriptions of the changes in this PR:
   
   When replacing a bookie, if there are two or more bookies that need to be 
replaced, our logic is to replace them one by one. However, after the 
replacement, we do not use the new bookies to replace the old ones in the 
ensemble. Therefore, the return result of isEnsembleAdheringToPlacementPolicy 
may be incorrect.
   
   The code:
   ```
           for (Integer bookieIndex : bookieIndexesToRereplicate) {
               BookieId oldBookie = newEnsemble.get(bookieIndex);
               EnsemblePlacementPolicy.PlacementResult<BookieId> 
replaceBookieResponse =
                       bkc.getPlacementPolicy().replaceBookie(
                               lh.getLedgerMetadata().getEnsembleSize(),
                               lh.getLedgerMetadata().getWriteQuorumSize(),
                               lh.getLedgerMetadata().getAckQuorumSize(),
                               lh.getLedgerMetadata().getCustomMetadata(),
                               ensemble,
                               oldBookie,
                               bookiesToExclude);
               BookieId newBookie = replaceBookieResponse.getResult();
                   LOG.debug(
                           "replaceBookie for bookie: {} in ensemble: {} "
                                   + "is not adhering to placement policy and 
chose {}",
                           oldBookie, newEnsemble, newBookie);
               }
               targetBookieAddresses.put(bookieIndex, newBookie);
               bookiesToExclude.add(newBookie);
               newEnsemble.set(bookieIndex, newBookie);
           }
   ```
   
   The 5th param `ensemble` in EnsemblePlacementPolicy#replaceBookie should be 
updated after replace.
   
   Example:
   The ensemble [0,1,2], we want to replace [1,2].
   
   Step1. replace 1 by 3, after replace, the 5th param ensemble should be 
[0,3,2], instead still [0,1,2].
    
   
   
   
   
   
   
   


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

Reply via email to