horizonzy commented on code in PR #4211:
URL: https://github.com/apache/bookkeeper/pull/4211#discussion_r1495183863
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerFragmentReplicator.java:
##########
@@ -433,6 +445,109 @@ public void readComplete(int rc, LedgerHandle lh,
}, null);
}
+ void batchRecoverLedgerFragmentEntry(final long startEntryId,
+ final long endEntryId,
+ final LedgerHandle lh,
+ final AsyncCallback.VoidCallback
ledgerFragmentMcb,
+ final Set<BookieId> newBookies,
+ final BiConsumer<Long, Long>
onReadEntryFailureCallback)
+ throws InterruptedException {
+ int entriesToReplicateCnt = (int) (endEntryId - startEntryId + 1);
+ int maxBytesToReplicate = conf.getReplicationRateByBytes();
+ if (replicationThrottle != null) {
+ if (maxBytesToReplicate != -1 && maxBytesToReplicate >
averageEntrySize.get() * entriesToReplicateCnt) {
+ maxBytesToReplicate = averageEntrySize.get() *
entriesToReplicateCnt;
+ }
+ replicationThrottle.acquire(maxBytesToReplicate);
+ }
+
+ lh.asyncBatchReadEntries(startEntryId, entriesToReplicateCnt,
maxBytesToReplicate,
+ new ReadCallback() {
+ @Override
+ public void readComplete(int rc, LedgerHandle lh,
Enumeration<LedgerEntry> seq, Object ctx) {
+ if (rc != BKException.Code.OK) {
+ LOG.error("BK error reading ledger entries: {} - {}",
+ startEntryId, endEntryId,
BKException.create(rc));
+ onReadEntryFailureCallback.accept(lh.getId(),
startEntryId);
+ ledgerFragmentMcb.processResult(rc, null, null);
Review Comment:
The `ledgerFragmentMcb` is `MultiCallback`, when batch read fails, the
`processResult` invoke count may be not enough.
--
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]