You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2021/08/23 06:58:02 UTC

[GitHub] [bookkeeper] Shoothzj opened a new issue #2770: In class SortedLedgerStorage's method ledgerExists, why don't we simplely return false

Shoothzj opened a new issue #2770:
URL: https://github.com/apache/bookkeeper/issues/2770


   Class SortedLedgerStorage, method ledgerExists
   ```java
   @Override
       public boolean ledgerExists(long ledgerId) throws IOException {
           // Done this way because checking the skip list is an O(logN) operation compared to
           // the O(1) for the ledgerCache.
           if (!interleavedLedgerStorage.ledgerExists(ledgerId)) {
               EntryKeyValue kv = memTable.getLastEntry(ledgerId);
               if (null == kv) {
                   return interleavedLedgerStorage.ledgerExists(ledgerId);
               }
           }
           return true;
       }
   ```
   I want to know why calculate ledgerExists() two times? Thanks


-- 
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: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org