rdhabalia commented on a change in pull request #2993: Handle unknown runtime
exception while reading entries
URL: https://github.com/apache/pulsar/pull/2993#discussion_r234027955
##########
File path:
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/EntryCacheImpl.java
##########
@@ -202,9 +216,23 @@ public void asyncReadEntry(ReadHandle lh, PositionImpl
position, final ReadEntry
}
@Override
- @SuppressWarnings({ "unchecked", "rawtypes" })
public void asyncReadEntry(ReadHandle lh, long firstEntry, long lastEntry,
boolean isSlowestReader,
final ReadEntriesCallback callback, Object ctx) {
+ try {
+ asyncReadEntry0(lh, firstEntry, lastEntry, isSlowestReader,
callback, ctx);
+ } catch (Throwable t) {
+ log.warn("failed to read entries for {}--{}-{}", lh.getId(),
firstEntry, lastEntry, t);
+ // invalidate all entries related to ledger from the cache (it
might happen if entry gets corrupt
+ // (entry.data is already deallocate due to any race-condition)
so, invalidate cache and next time read from
+ // the bookie)
+ invalidateAllEntries(lh.getId());
+ callback.readEntriesFailed(createManagedLedgerException(t), ctx);
+ }
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void asyncReadEntry0(ReadHandle lh, long firstEntry, long
lastEntry, boolean isSlowestReader,
Review comment:
oops.. let me fix it.
----------------------------------------------------------------
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