eolivelli commented on a change in pull request #2166: Enhance
deferLedgerLockReleaseOfFailedLedger in ReplicationWorker
URL: https://github.com/apache/bookkeeper/pull/2166#discussion_r329087272
##########
File path:
bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/ReplicationWorker.java
##########
@@ -270,6 +294,42 @@ private void logBKExceptionAndReleaseLedger(BKException
e, long ledgerIdToReplic
getExceptionCounter(e.getClass().getSimpleName()).inc();
}
+ private boolean tryReadingFaultyEntries(LedgerHandle lh, LedgerFragment
ledgerFragment) {
+ ConcurrentSkipListSet<Long> entriesUnableToReadForThisLedger =
unableToReadEntriesForReplication
+ .getIfPresent(lh.getId());
+ if (entriesUnableToReadForThisLedger == null) {
+ return true;
+ }
+ long firstEntryIdOfFragment = ledgerFragment.getFirstEntryId();
+ long lastEntryIdOfFragment = ledgerFragment.getLastKnownEntryId();
+ NavigableSet<Long> entriesOfThisFragmentUnableToRead =
entriesUnableToReadForThisLedger
+ .subSet(firstEntryIdOfFragment, true, lastEntryIdOfFragment,
true);
+ if (entriesOfThisFragmentUnableToRead.isEmpty()) {
+ return true;
+ }
+ final CountDownLatch numEntriesToRead = new
CountDownLatch(entriesOfThisFragmentUnableToRead.size());
+ final AtomicInteger returnRCValue = new
AtomicInteger(BKException.Code.OK);
+ for (long entryIdToRead : entriesOfThisFragmentUnableToRead) {
+ lh.asyncReadEntries(entryIdToRead, entryIdToRead, (rc, ledHan,
seq, ctx) -> {
+ long thisEntryId = (Long) ctx;
+ if (rc == BKException.Code.OK) {
+ entriesUnableToReadForThisLedger.remove(thisEntryId);
+ } else {
+ LOG.error("Received error: {} while trying to read entry
in ReplicationWorker", rc);
Review comment:
can we write the LedgerId (and entryId ?)
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services