/ Check-in [383437be]
Login

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

Overview
Comment:Adjustments to the page cache to try to avoid harmless TSAN warnings.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 383437be276719ac1c72688ae81017c63907ac561f2ffb8e42c43b012248f294
User & Date: drh 2019-01-09 14:49:58
Context
2019-01-09
21:12
Fix an out-of-bounds read in SQL function fts5_decode() that could occur if it was passed a corrupt record. check-in: 931278b2 user: dan tags: trunk
14:49
Adjustments to the page cache to try to avoid harmless TSAN warnings. check-in: 383437be user: drh tags: trunk
11:19
Improved database corruption detection in the dbstat virtual table. check-in: fc5ecc88 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/pcache1.c.

   164    164     int szExtra;                        /* sizeof(MemPage)+sizeof(PgHdr) */
   165    165     int szAlloc;                        /* Total size of one pcache line */
   166    166     int bPurgeable;                     /* True if cache is purgeable */
   167    167     unsigned int nMin;                  /* Minimum number of pages reserved */
   168    168     unsigned int nMax;                  /* Configured "cache_size" value */
   169    169     unsigned int n90pct;                /* nMax*9/10 */
   170    170     unsigned int iMaxKey;               /* Largest key seen since xTruncate() */
          171  +  unsigned int nPurgeableDummy;       /* pnPurgeable points here when not used*/
   171    172   
   172    173     /* Hash table of all pages. The following variables may only be accessed
   173    174     ** when the accessor is holding the PGroup mutex.
   174    175     */
   175    176     unsigned int nRecyclable;           /* Number of pages in the LRU list */
   176    177     unsigned int nPage;                 /* Total number of pages in apHash */
   177    178     unsigned int nHash;                 /* Number of slots in apHash[] */
................................................................................
   781    782       pcache1ResizeHash(pCache);
   782    783       if( bPurgeable ){
   783    784         pCache->nMin = 10;
   784    785         pGroup->nMinPage += pCache->nMin;
   785    786         pGroup->mxPinned = pGroup->nMaxPage + 10 - pGroup->nMinPage;
   786    787         pCache->pnPurgeable = &pGroup->nPurgeable;
   787    788       }else{
   788         -      static unsigned int dummyCurrentPage;
   789         -      pCache->pnPurgeable = &dummyCurrentPage;
          789  +      pCache->pnPurgeable = &pCache->nPurgeableDummy;
   790    790       }
   791    791       pcache1LeaveMutex(pGroup);
   792    792       if( pCache->nHash==0 ){
   793    793         pcache1Destroy((sqlite3_pcache*)pCache);
   794    794         pCache = 0;
   795    795       }
   796    796     }