zymap commented on code in PR #2903:
URL: https://github.com/apache/bookkeeper/pull/2903#discussion_r932829257


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/SortedLedgerStorage.java:
##########
@@ -144,9 +144,7 @@ public boolean ledgerExists(long ledgerId) throws 
IOException {
         // the O(1) for the ledgerCache.
         if (!interleavedLedgerStorage.ledgerExists(ledgerId)) {
             EntryKeyValue kv = memTable.getLastEntry(ledgerId);
-            if (null == kv) {
-                return interleavedLedgerStorage.ledgerExists(ledgerId);

Review Comment:
   As the comment said, checking the skip list is an O(logN) operation compared 
to the O(1) for the ledgerCache.
   
   Which means the `memTable.getLastEntry(ledgerId)` is time consuming 
operation. After check that, the ledgerCache may be filled so we check it again.



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