eolivelli commented on code in PR #17241:
URL: https://github.com/apache/pulsar/pull/17241#discussion_r955704726


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/cache/RangeEntryCacheImpl.java:
##########
@@ -256,6 +276,132 @@ public void asyncReadEntry(ReadHandle lh, long 
firstEntry, long lastEntry, boole
         }
     }
 
+    @AllArgsConstructor
+    private static final class ReadEntriesCallbackWithContext {
+        final ReadEntriesCallback callback;
+        final Object ctx;
+        final long startEntry;
+        final long endEntry;
+    }
+
+    private CachedPendingRead findBestCandidate(PendingReadKey key, 
Map<PendingReadKey, CachedPendingRead> ledgerCache,
+                                                AtomicBoolean created) {
+        synchronized (ledgerCache) {
+            CachedPendingRead existing = ledgerCache.get(key);
+            if (existing != null) {
+                return existing;
+            }
+            // TODO: use a sorted map

Review Comment:
   I am not 100% that we need a SortedMap to make the search more efficient.
   sorting the map by the "startEntry" does not help much.
   
   in my tests it is more likely that the "endEntry" is in common (because 
during tailing reads you hit the wall of the last written message)



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