Loading...

sqlite-dev@sqlite.org

[Prev] Thread [Next]  |  [Prev] Date [Next]

[sqlite-dev] Page recycling in pcache1Fetch Jim Gullen Fri Feb 03 12:03:40 2012

In pcache1.cpp, two issues (one bug, one idea) with "Step 4. Try to recycle a 
page":
Issue 1. In line 770, "nPage+1" should be "nPage". The "+1" only allows up to 
nMax - 1 pages.
Issue 2. On line 769, pls. consider adding a min. pages cond.:  "&& 
(pCache->nPage > 5)"
 
0768: /* Step 4. Try to recycle a page. */
0769: if( pCache->bPurgeable && pGroup->pLruTail && (
0770: (pCache->nPage+1>=pCache->nMax)
0771: || pGroup->nCurrentPage>=pGroup->nMaxPage
0772: || pcache1UnderMemoryPressure(pCache)
0773: )){
0774: PCache1 *pOther;
0775: pPage = pGroup->pLruTail;
0776: pcache1RemoveFromHash(pPage);
0777: pcache1PinPage(pPage);

Discussion:
Issue 1. The code should obey pCache->nMax as-is; i.e. treat nMax set to 8 as 
8, not 7.
Issue 2. (It seems) When memory is under pressure (see 3rd "or" cond) every 
database newly joining the pool will be DENIED a minimum participation. Not 
fair! This added minimum page count could also be configurable. Our use of 8KB 
pages (i.e. lots of indexes per page) makes fewer pages (5 or less) a workable 
number; others' may need or desire a different, minimum page count (per 
database, even).
 
x
_______________________________________________
sqlite-dev mailing list
[EMAIL PROTECTED]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-dev