sijie commented on a change in pull request #229: Issue 228: BookKeeper Server: Index Page Management Memory Growth URL: https://github.com/apache/bookkeeper/pull/229#discussion_r127821482
########## File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/IndexInMemPageMgr.java ########## @@ -542,26 +621,27 @@ void putEntryOffset(long ledger, long entry, long offset) throws IOException { // find the id of the first entry of the page that has the entry // we are looking for long pageEntry = entry - offsetInPage; - LedgerEntryPage lep = getLedgerEntryPage(ledger, pageEntry, false); - if (lep == null) { - lep = grabLedgerEntryPage(ledger, pageEntry); + LedgerEntryPage lep = null; + try { + lep = getLedgerEntryPage(ledger, pageEntry); + assert lep != null; + lep.setOffset(offset, offsetInPage * LedgerEntryPage.getIndexEntrySize()); + } finally { + if (null != lep) { + lep.releasePage(); + } } - assert lep != null; - lep.setOffset(offset, offsetInPage * LedgerEntryPage.getIndexEntrySize()); - lep.releasePage(); } long getEntryOffset(long ledger, long entry) throws IOException { int offsetInPage = (int) (entry % entriesPerPage); // find the id of the first entry of the page that has the entry // we are looking for - long pageEntry = entry - offsetInPage; - LedgerEntryPage lep = getLedgerEntryPage(ledger, pageEntry, false); + long pageEntry = entry-offsetInPage; Review comment: done ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services