[ 
https://issues.apache.org/jira/browse/BOOKKEEPER-198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13242202#comment-13242202
 ] 

Sijie Guo commented on BOOKKEEPER-198:
--------------------------------------

actually, we don't need to decrement the page count in successful case. when we 
need to grab a clean page, we find the available page from existing pages in 
ledger cache, if there exists a clean page in pages pool (HashMap<Long, 
HashMap<Long,LedgerEntryPage>>), we remove it from pages pool, make it as a 
zero page and available for new request to use. so the ledger page is just 
changing the ownership, we don't need to decrement pageCount.

only the case we need to decrement pageCount is after removing it from pages 
pool, but new request failed to use it. it is orphan page, we need to decrement 
it.

from this side, the pageCount would not go negative, since the max number of 
decrements would not be more than number pages existed in pages pool, and the 
number of pages in pages pool is pageLimit.
                
> replaying entries of deleted ledgers would exhaust ledger cache.
> ----------------------------------------------------------------
>
>                 Key: BOOKKEEPER-198
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-198
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Sijie Guo
>            Assignee: Sijie Guo
>             Fix For: 4.1.0
>
>         Attachments: BK-198.patch, BK-198.patch_v2
>
>
> we found that replaying entries of deleted ledgers would exhaust ledger 
> cache. then ledger cache would no clean page to grab, it would throw 
> following exception.
> {code}
> java.util.NoSuchElementException
>         at java.util.LinkedList.getFirst(LinkedList.java:109)
>         at 
> org.apache.bookkeeper.bookie.LedgerCacheImpl.grabCleanPage(LedgerCacheImpl.java:454)
>         at 
> org.apache.bookkeeper.bookie.LedgerCacheImpl.putEntryOffset(LedgerCacheImpl.java:165)
> {code}
> this issue is because bookie grabs a clean page but fail to updating page due 
> to NoLedgerException, but bookie doesn't return this clean page back to 
> ledger cache. so the ledger cache is exhausted, when new ledger want to grab 
> a clean page, it failed to find available page.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to