ivankelly commented on a change in pull request #1218: Support LacPiggyback, 
LongPoll and ExplicitLac in db ledger storage
URL: https://github.com/apache/bookkeeper/pull/1218#discussion_r171245060
 
 

 ##########
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorage.java
 ##########
 @@ -712,23 +874,38 @@ public EntryLogger getEntryLogger() {
 
     @Override
     public long getLastAddConfirmed(long ledgerId) throws IOException {
-        throw new UnsupportedOperationException();
+        TransientLedgerInfo ledgerInfo = 
transientLedgerInfoCache.getIfPresent(ledgerId);
+        Long lac = null != ledgerInfo ? ledgerInfo.getLastAddConfirmed() : 
null;
+        if (null == lac) {
+            ByteBuf bb = getEntry(ledgerId, BookieProtocol.LAST_ADD_CONFIRMED);
 
 Review comment:
   It'd be better to do this in the loader, and not rely on a 
getLastAddConfirmed coming before getExplicitLAC or any of the other calls. If 
it's in the loader, it becomes easier to reason about the state. This method 
becomes 
   ```
   return transientLedgerInfoCache.getUnchecked(ledgerId).getLastAddConfirmed();
   ```
   No checking, because we can assume ledger info cache is up to date.

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

Reply via email to