From: drh Date: Wed, 26 Jan 2011 00:07:03 +0000 (+0000) Subject: Rename the PCache1.mxPinned field to n90pct (since it is 90% of nMax) in order X-Git-Tag: version-3.7.5~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=25ca568251968708456750718c2342e358aa7c93;p=thirdparty%2Fsqlite.git 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. FossilOrigin-Name: c85202baac49b22a4be36b9733d44f01d83edb28 --- diff --git a/manifest b/manifest index b261f28f5b..f452235443 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -C Fix\snew\scompiler\swarnings\sin\spcache1.c\sthat\swere\sintroduced\sby\sthe\srecent\nperformance\senhancement\spatches\sof\s[e14649301138b684]. -D 2011-01-25T18:30:51.294 +C Rename\sthe\sPCache1.mxPinned\sfield\sto\sn90pct\s(since\sit\sis\s90%\sof\snMax)\sin\sorder\nto\sdistinguish\sit\sfrom\sPGroup.mxPinned.\s\sFix\sthe\scomputation\sof\sn90pct\sso\sthat\nit\sdoes\snot\soverflow\sadversely\son\sexcessively\slarge\scache\ssizes. +D 2011-01-26T00:07:03.942 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in de6498556d536ae60bb8bb10e8c1ba011448658c F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -170,7 +170,7 @@ F src/pager.h 0ea59db2a33bc6c2c02cae34de33367e1effdf76 F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58 F src/pcache.c 09d38c44ab275db581f7a2f6ff8b9bc7f8c0faaa F src/pcache.h c683390d50f856d4cd8e24342ae62027d1bb6050 -F src/pcache1.c 71948ab1b3c792675a7676f991b53f3386cf0af4 +F src/pcache1.c 6901229309a7896e7635ca404f224a0a591bdfb2 F src/pragma.c 8a6cd3c787f882fa44f6490d2411fc26839ce8f3 F src/prepare.c 395b3fab1b93f45b6aa194b23ebc201221c47b99 F src/printf.c df2ff3bb5409e8958136933342c46464fbd017e7 @@ -900,14 +900,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 1965b85318c1fac62fae9691059021b298c17dde -R e2194786a7af1bc58874d331b4d38324 +P c17703ec1e604934f8bd5b1f66f34b19d17a6d1f +R 109c7d92ff691fdbec42c31d55aa6410 U drh -Z 1ce03f19d621ba40ce2711b30eaeab7c +Z 0733d70beb9057473e955a3b5b264719 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) -iD8DBQFNPxbeoxKgR168RlERAmLIAJ9qPhe/e/BRFS7gQNSAhVYcXdVllgCeNPtT -BRtjsNpdZ3Uj5WkxW69HZ1g= -=xwOA +iD8DBQFNP2WroxKgR168RlERArihAJ9FjxySq+QwzE3GYgMW9h2HMqvBogCfVKVW +Qn6jaMIKh2jPgnqXtNc05Yk= +=HMnc -----END PGP SIGNATURE----- diff --git a/manifest.uuid b/manifest.uuid index 6fe948e00c..a8c99a8928 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c17703ec1e604934f8bd5b1f66f34b19d17a6d1f \ No newline at end of file +c85202baac49b22a4be36b9733d44f01d83edb28 \ No newline at end of file diff --git a/src/pcache1.c b/src/pcache1.c index 93435fecd7..4de01376b4 100644 --- a/src/pcache1.c +++ b/src/pcache1.c @@ -74,7 +74,7 @@ struct PCache1 { int bPurgeable; /* True if cache is purgeable */ unsigned int nMin; /* Minimum number of pages reserved */ unsigned int nMax; /* Configured "cache_size" value */ - unsigned int mxPinned; /* nMax*9/10 */ + unsigned int n90pct; /* nMax*9/10 */ /* Hash table of all pages. The following variables may only be accessed ** when the accessor is holding the PGroup mutex. @@ -599,7 +599,7 @@ static void pcache1Cachesize(sqlite3_pcache *p, int nMax){ pGroup->nMaxPage += (nMax - pCache->nMax); pGroup->mxPinned = pGroup->nMaxPage + 10 - pGroup->nMinPage; pCache->nMax = nMax; - pCache->mxPinned = nMax*9/10; + pCache->n90pct = pCache->nMax*9/10; pcache1EnforceMaxPage(pGroup); pcache1LeaveMutex(pGroup); } @@ -709,11 +709,12 @@ static void *pcache1Fetch(sqlite3_pcache *p, unsigned int iKey, int createFlag){ /* Step 3: Abort if createFlag is 1 but the cache is nearly full */ nPinned = pCache->nPage - pCache->nRecyclable; + assert( nPinned>=0 ); assert( pGroup->mxPinned == pGroup->nMaxPage + 10 - pGroup->nMinPage ); - assert( pCache->mxPinned == pCache->nMax*9/10 ); + assert( pCache->n90pct == pCache->nMax*9/10 ); if( createFlag==1 && ( nPinned>=pGroup->mxPinned - || nPinned>=(int)pCache->mxPinned + || nPinned>=(int)pCache->n90pct || pcache1UnderMemoryPressure(pCache) )){ goto fetch_out;