SQLite

Check-in [c17703ec1e]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix new compiler warnings in pcache1.c that were introduced by the recent performance enhancement patches of [e14649301138b684].
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c17703ec1e604934f8bd5b1f66f34b19d17a6d1f
User & Date: drh 2011-01-25 18:30:51.294
Context
2011-01-26
00:07
Rename the PCache1.mxPinned field to n90pct (since it is 90% of nMax) in order to distinguish it from PGroup.mxPinned. Fix the computation of n90pct so that it does not overflow adversely on excessively large cache sizes. (check-in: c85202baac user: drh tags: trunk)
2011-01-25
18:30
Fix new compiler warnings in pcache1.c that were introduced by the recent performance enhancement patches of [e14649301138b684]. (check-in: c17703ec1e user: drh tags: trunk)
18:19
Add a missing call to sqlite3PagerSync() removed by [ce552d975] to the backup code. (check-in: 1965b85318 user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/pcache1.c.
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
**      then attempt to recycle a page from the LRU list. If it is the right
**      size, return the recycled buffer. Otherwise, free the buffer and
**      proceed to step 5. 
**
**   5. Otherwise, allocate and return a new page buffer.
*/
static void *pcache1Fetch(sqlite3_pcache *p, unsigned int iKey, int createFlag){
  unsigned int nPinned;
  PCache1 *pCache = (PCache1 *)p;
  PGroup *pGroup;
  PgHdr1 *pPage = 0;

  assert( pCache->bPurgeable || createFlag!=1 );
  assert( pCache->bPurgeable || pCache->nMin==0 );
  assert( pCache->bPurgeable==0 || pCache->nMin==10 );







|







668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
**      then attempt to recycle a page from the LRU list. If it is the right
**      size, return the recycled buffer. Otherwise, free the buffer and
**      proceed to step 5. 
**
**   5. Otherwise, allocate and return a new page buffer.
*/
static void *pcache1Fetch(sqlite3_pcache *p, unsigned int iKey, int createFlag){
  int nPinned;
  PCache1 *pCache = (PCache1 *)p;
  PGroup *pGroup;
  PgHdr1 *pPage = 0;

  assert( pCache->bPurgeable || createFlag!=1 );
  assert( pCache->bPurgeable || pCache->nMin==0 );
  assert( pCache->bPurgeable==0 || pCache->nMin==10 );
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723

  /* Step 3: Abort if createFlag is 1 but the cache is nearly full */
  nPinned = pCache->nPage - pCache->nRecyclable;
  assert( pGroup->mxPinned == pGroup->nMaxPage + 10 - pGroup->nMinPage );
  assert( pCache->mxPinned == pCache->nMax*9/10 );
  if( createFlag==1 && (
        nPinned>=pGroup->mxPinned
     || nPinned>=pCache->mxPinned
     || pcache1UnderMemoryPressure(pCache)
  )){
    goto fetch_out;
  }

  if( pCache->nPage>=pCache->nHash && pcache1ResizeHash(pCache) ){
    goto fetch_out;







|







709
710
711
712
713
714
715
716
717
718
719
720
721
722
723

  /* Step 3: Abort if createFlag is 1 but the cache is nearly full */
  nPinned = pCache->nPage - pCache->nRecyclable;
  assert( pGroup->mxPinned == pGroup->nMaxPage + 10 - pGroup->nMinPage );
  assert( pCache->mxPinned == pCache->nMax*9/10 );
  if( createFlag==1 && (
        nPinned>=pGroup->mxPinned
     || nPinned>=(int)pCache->mxPinned
     || pcache1UnderMemoryPressure(pCache)
  )){
    goto fetch_out;
  }

  if( pCache->nPage>=pCache->nHash && pcache1ResizeHash(pCache) ){
    goto fetch_out;