Source:
<code>public void readLacComplete(int rc, long ledgerId, final ByteBuf lacBuffer, final ByteBuf lastEntryBuffer, Object ctx) { int bookieIndex = (Integer) ctx; numResponsesPending--; if (completed) { return; } if (rc == BKException.Code.OK) { try { long newLac = LedgerHandle.INVALID_ENTRY_ID; if (lacBuffer != null && lacBuffer.readableBytes() > 0) { long lac = lh.macManager.verifyDigestAndReturnLac(lacBuffer); if (lac > maxLac) { newLac = lac; } } if (lastEntryBuffer != null && lastEntryBuffer.readableBytes() > 0) { RecoveryData recoveryData = lh.macManager.verifyDigestAndReturnLastConfirmed(lastEntryBuffer); <START> long recoveredLac = recoveryData.getLastAddConfirmed(); <END> if (recoveredLac > maxLac) { newLac = recoveredLac; } } if (newLac > maxLac) { cb.getLacComplete(rc, newLac); completed = true; } maxLac = newLac; hasValidResponse = true; } catch (BKDigestMatchException e) { LOG.error("Mac mismatch while reading ledger: " + ledgerId + " LAC from bookie: " + currentEnsemble.get(bookieIndex)); rc = BKException.Code.DigestMatchException; } } if (rc == BKException.Code.NoSuchLedgerExistsException || rc == BKException.Code.NoSuchEntryException) { hasValidResponse = true; } if (rc == BKException.Code.UnauthorizedAccessException && !completed) { cb.getLacComplete(rc, maxLac); completed = true; return; } if (!hasValidResponse && BKException.Code.OK != rc) { lastSeenError = rc; } if (numResponsesPending == 0 && !completed) { if (!hasValidResponse) { cb.getLacComplete(lastSeenError, maxLac); } else { cb.getLacComplete(BKException.Code.OK, maxLac); } completed = true; } }</code><technical_language>called piggyBackedLAC</technical_language>

Target:
public void readLacComplete(int rc, long ledgerId, final ByteBuf lacBuffer, final ByteBuf lastEntryBuffer, Object ctx) { int bookieIndex = (Integer) ctx; numResponsesPending--; if (completed) { return; } if (rc == BKException.Code.OK) { try { long newLac = LedgerHandle.INVALID_ENTRY_ID; if (lacBuffer != null && lacBuffer.readableBytes() > 0) { long lac = lh.macManager.verifyDigestAndReturnLac(lacBuffer); if (lac > maxLac) { newLac = lac; } } if (lastEntryBuffer != null && lastEntryBuffer.readableBytes() > 0) { RecoveryData recoveryData = lh.macManager.verifyDigestAndReturnLastConfirmed(lastEntryBuffer); long piggyBackedLAC = recoveryData.getLastAddConfirmed(); if (piggyBackedLAC > newLac) { newLac = piggyBackedLAC; } } if (newLac > maxLac) { cb.getLacComplete(rc, newLac); completed = true; } maxLac = newLac; hasValidResponse = true; } catch (BKDigestMatchException e) { LOG.error("Mac mismatch while reading ledger: " + ledgerId + " LAC from bookie: " + currentEnsemble.get(bookieIndex)); rc = BKException.Code.DigestMatchException; } } if (rc == BKException.Code.NoSuchLedgerExistsException || rc == BKException.Code.NoSuchEntryException) { hasValidResponse = true; } if (rc == BKException.Code.UnauthorizedAccessException && !completed) { cb.getLacComplete(rc, maxLac); completed = true; return; } if (!hasValidResponse && BKException.Code.OK != rc) { lastSeenError = rc; } if (numResponsesPending == 0 && !completed) { if (!hasValidResponse) { cb.getLacComplete(lastSeenError, maxLac); } else { cb.getLacComplete(BKException.Code.OK, maxLac); } completed = true; } }