lhotari commented on code in PR #22560:
URL: https://github.com/apache/pulsar/pull/22560#discussion_r2904259574


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:
##########
@@ -2443,6 +2556,22 @@ protected void asyncReadEntry(ReadHandle ledger, long 
firstEntry, long lastEntry
         }
     }
 
+    protected void asyncReadEntry(ReadHandle ledger, long firstEntry, long 
lastEntry, ManagedCursorImpl cursor,
+                                  ReadEntriesCallback callback, Object ctx) {
+        IntSupplier expectedReadCount = 
cursor::getNumberOfCursorsAtSamePositionOrBefore;
+        if (config.getReadEntryTimeoutSeconds() > 0) {
+            // set readOpCount to uniquely validate if 
ReadEntryCallbackWrapper is already recycled
+            long readOpCount = READ_OP_COUNT_UPDATER.incrementAndGet(this);
+            long createdTime = System.nanoTime();
+            ReadEntryCallbackWrapper readCallback = 
ReadEntryCallbackWrapper.create(name, ledger.getId(), firstEntry,
+                    callback, readOpCount, createdTime, ctx);
+            lastReadCallback = readCallback;

Review Comment:
   Sidenote: In the case of multiple reads, it would be useful to have a 
separate timeout value. So that an individual read would be retried until the 
total read timeout is met. The reason for this is that when a single read times 
out, all read results are discarded. This is already a problem with the 
individual reads, so it should be something that is handled in a separate PR. 
This particular detail is why the use of the current read timeout setting 
results in a cascading effect that adds more load to the system when the system 
is already under high load.



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