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

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

> If the pool size is supposed to be constant, then why do we have a page count?

actually, ledger cache doesn't preallocate the pages pool. it did that 
incrementally. so we need a page count.
when the size of pages reaches pageLimit, it becomes be constant.

newly requests to grab a new page just acts as borrowing existing clean pages 
in the pages pool.

> Why don't we return the page to the pool in the case of a failure?

actually the pool is a mapping between ledger id and pages. the failure 
happened after we borrowed an existing clean page from other ledgers and before 
we put it again to table. the original info in that page has been cleaned after 
we grabbed it, so we don't know where to return it back. this page becomes 
orphan, the only way is to drop it and decrement the pageCount, so a new page 
would be allocated to replace the orphan in future requests.
{quote}
168         LedgerEntryPage lep = grabCleanPage(ledger, pageEntry);
169         try {
170             // should update page before we put it into table
171             // otherwise we would put an empty page in it
172             updatePage(lep);
173             synchronized(this) {
174                 putIntoTable(pages, lep);
175             }
{quote}
                
> 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