horizonzy commented on code in PR #3359:
URL: https://github.com/apache/bookkeeper/pull/3359#discussion_r928059554
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerFragment.java:
##########
@@ -217,11 +218,27 @@ public List<BookieId> getEnsemble() {
return this.ensemble;
}
+ public ReplicateType getReplicateType() {
+ return replicateType;
+ }
+
+ public void setReplicateType(ReplicateType replicateType) {
+ this.replicateType = replicateType;
+ }
+
@Override
public String toString() {
return String.format("Fragment(LedgerID: %d, FirstEntryID: %d[%d], "
+ "LastKnownEntryID: %d[%d], Host: %s, Closed: %s)", ledgerId,
firstEntryId,
getFirstStoredEntryId(), lastKnownEntryId,
getLastStoredEntryId(),
getAddresses(), isLedgerClosed);
}
+
+ /**
+ * ReplicateType.
+ */
+ public enum ReplicateType {
+ DATA_LOSS,
Review Comment:
see line_42, the default type is `DATA_LOSS`
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookKeeperAdmin.java:
##########
@@ -1128,14 +1129,24 @@ private ArrayList<BookieId> replaceBookiesInEnsemble(
* @param ledgerFragment
* - LedgerFragment to replicate
*/
- public void replicateLedgerFragment(LedgerHandle lh,
- final LedgerFragment ledgerFragment,
- final BiConsumer<Long, Long> onReadEntryFailureCallback)
- throws InterruptedException, BKException {
- Optional<Set<BookieId>> excludedBookies = Optional.empty();
- Map<Integer, BookieId> targetBookieAddresses =
- getReplacementBookiesByIndexes(lh,
ledgerFragment.getEnsemble(),
- ledgerFragment.getBookiesIndexes(), excludedBookies);
+ public void replicateLedgerFragment(LedgerHandle lh, final LedgerFragment
ledgerFragment,
+ final BiConsumer<Long, Long> onReadEntryFailureCallback) throws
InterruptedException, BKException {
+ Map<Integer, BookieId> targetBookieAddresses = null;
+ if (LedgerFragment.ReplicateType.DATA_LOSS ==
ledgerFragment.getReplicateType()) {
Review Comment:
On the `DATA_LOSS`, we know the bad bookie we want to replace in the
ledgerChecker.
On the `DATA_NOT_ADHERING_PLACEMENT`, we just know the ensemble is not
adhering the placement policy, so we need find which bookie should be replaced.
--
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]