From: dan Date: Wed, 11 May 2016 20:03:23 +0000 (+0000) Subject: Remove a redundant condition from pcache.c. Add an OPTIMIZATION-IF-TRUE comment to... X-Git-Tag: version-3.13.0~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=401907e3ff7616e85469752102c52f4bdaf7d73c;p=thirdparty%2Fsqlite.git Remove a redundant condition from pcache.c. Add an OPTIMIZATION-IF-TRUE comment to another condition that requires it. FossilOrigin-Name: 3bfd2621d13b4f842f3af6d35519653f4eb8cad7 --- diff --git a/manifest b/manifest index a51e55cb83..6c5a26e092 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\ssome\sa\ssmall\samount\sof\sredundant\scode\srelated\sto\sPCache.pSynced\sfrom\spcache.c. -D 2016-05-11T15:41:15.317 +C Remove\sa\sredundant\scondition\sfrom\spcache.c.\sAdd\san\sOPTIMIZATION-IF-TRUE\scomment\sto\sanother\scondition\sthat\srequires\sit. +D 2016-05-11T20:03:23.145 F Makefile.in 9eda6e1c90d05c199c3ec8a7069b0682ad307657 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc db82b35aef27f412fef14d8534afc022138bcdfd @@ -367,7 +367,7 @@ F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca F src/pager.c cb7a3990eabd895f6487c0856a7fec02b5e40faa F src/pager.h 329bdf078a4e0a3b35084534d58625d21fd03681 F src/parse.y 10eb2f3fb62341291528c7984498054731f9d31e -F src/pcache.c 4af980bc2a987cf81ddbe867d238c9ccdbaac95c +F src/pcache.c 95ee5008eddda9c61b8d053de8eebf72cf5df7c6 F src/pcache.h 6b865be765d1ebd06145219550b10921c7da7cc9 F src/pcache1.c 7f51d2b541aab57596adf62db2c4bb025d34f04d F src/pragma.c faf42922bb7ab2f6672cb550356c1967abae3c84 @@ -1488,7 +1488,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 345ce1c9f64f2a424663b4dfcbe4586d9df7bff6 -R 410857f6cadf18a1818aed66391afc72 +P 9cc8cad78fdfe044ad6726ebfe6909c1e242fa55 +R bd613f88cc94ba593741d724ce8bf946 U dan -Z b239392669bc1d86adff0f06ee03f5ae +Z ba94a14dc94ea0c9562dd2071f1152d6 diff --git a/manifest.uuid b/manifest.uuid index 9b2b37fae9..034ae63216 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9cc8cad78fdfe044ad6726ebfe6909c1e242fa55 \ No newline at end of file +3bfd2621d13b4f842f3af6d35519653f4eb8cad7 \ No newline at end of file diff --git a/src/pcache.c b/src/pcache.c index 54b4044a01..4051bee00e 100644 --- a/src/pcache.c +++ b/src/pcache.c @@ -94,10 +94,15 @@ static void pcacheManageDirtyList(PgHdr *pPage, u8 addRemove){ if( pPage->pDirtyPrev ){ pPage->pDirtyPrev->pDirtyNext = pPage->pDirtyNext; }else{ + /* If there are now no dirty pages in the cache, set eCreate to 2. + ** This is an optimization that allows sqlite3PcacheFetch() to skip + ** searching for a dirty page to eject from the cache when it might + ** otherwise have to. */ assert( pPage==p->pDirty ); p->pDirty = pPage->pDirtyNext; - if( p->pDirty==0 && p->bPurgeable ){ - assert( p->eCreate==1 ); + assert( p->bPurgeable || p->eCreate==2 ); + if( p->pDirty==0 ){ /*OPTIMIZATION-IF-TRUE*/ + assert( p->bPurgeable==0 || p->eCreate==1 ); p->eCreate = 2; } } @@ -266,6 +271,7 @@ sqlite3_pcache_page *sqlite3PcacheFetch( assert( pCache->pCache!=0 ); assert( createFlag==3 || createFlag==0 ); assert( pgno>0 ); + assert( pCache->eCreate==((pCache->bPurgeable && pCache->pDirty) ? 1 : 2) ); /* eCreate defines what to do if the page does not exist. ** 0 Do not allocate a new page. (createFlag==0)