From: drh Date: Thu, 3 Sep 2015 17:54:32 +0000 (+0000) Subject: Change the Pager.hasBeenUsed flag into Pager.hasHeldSharedLock in order to X-Git-Tag: version-3.9.0~157 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c98a4cc8b6a2fd2a54d6281279f46ccb14ec2e81;p=thirdparty%2Fsqlite.git Change the Pager.hasBeenUsed flag into Pager.hasHeldSharedLock in order to take it off the critical path in sqlite3PagerAcquire(). FossilOrigin-Name: b79096be7cb02aae2f303db33a8bf19e69204374 --- diff --git a/manifest b/manifest index 5e842820c7..9427db7679 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\ssqlite3VdbeLoadString()\sand\ssqlite3VdbeMultiLoad()\sroutines\sto\shelp\nwith\scode\sgeneration,\sespecially\son\sPRAGMAs.\s\sRename\ssqlite3VdbeAddGoto()\nto\sjust\ssqlite3VdbeGoto(). -D 2015-09-03T13:46:12.406 +C Change\sthe\sPager.hasBeenUsed\sflag\sinto\sPager.hasHeldSharedLock\sin\sorder\sto\ntake\sit\soff\sthe\scritical\spath\sin\ssqlite3PagerAcquire(). +D 2015-09-03T17:54:32.014 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in f85066ce844a28b671aaeeff320921cd0ce36239 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -324,7 +324,7 @@ F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa F src/os_unix.c 76f493ed71c4154338049dee1bf6e47f69c74a55 F src/os_win.c 40b3af7a47eb1107d0d69e592bec345a3b7b798a F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca -F src/pager.c aa916ca28606ccf4b6877dfc2b643ccbca86589f +F src/pager.c 2a9d77ac483a684c4187ec9ca786b551d3adfda5 F src/pager.h 6d435f563b3f7fcae4b84433b76a6ac2730036e2 F src/parse.y f599aa5e871a493330d567ced93de696f61f48f7 F src/pcache.c cde06aa50962595e412d497e22fd2e07878ba1f0 @@ -1380,7 +1380,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P d7f4bdf594e93c848f46901637861c8eed4c34df -R 87d27a58ce6d4a6cd03f169f2370f2fe +P 847387ec8e6fef283899578fb232b2c23b00ee5b +R 530c1d1d05feba269ca8969115207173 U drh -Z bdbaccc5e83ea81c60c1b2c883af5b3e +Z e28985417ac4a7094ed6187f7e395585 diff --git a/manifest.uuid b/manifest.uuid index 3428834616..eaef64ee94 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -847387ec8e6fef283899578fb232b2c23b00ee5b \ No newline at end of file +b79096be7cb02aae2f303db33a8bf19e69204374 \ No newline at end of file diff --git a/src/pager.c b/src/pager.c index 060edb8d1d..f4e27f36ca 100644 --- a/src/pager.c +++ b/src/pager.c @@ -647,7 +647,7 @@ struct Pager { u8 doNotSpill; /* Do not spill the cache when non-zero */ u8 subjInMemory; /* True to use in-memory sub-journals */ u8 bUseFetch; /* True to use xFetch() */ - u8 hasBeenUsed; /* True if any content previously read */ + u8 hasHeldSharedLock; /* True if a shared lock has ever been held */ Pgno dbSize; /* Number of pages in the database */ Pgno dbOrigSize; /* dbSize before the current transaction */ Pgno dbFileSize; /* Number of pages in the database file */ @@ -5097,10 +5097,10 @@ int sqlite3PagerSharedLock(Pager *pPager){ ); } - if( !pPager->tempFile && pPager->hasBeenUsed ){ + if( !pPager->tempFile && pPager->hasHeldSharedLock ){ /* The shared-lock has just been acquired then check to ** see if the database has been modified. If the database has changed, - ** flush the cache. The pPager->hasBeenUsed flag prevents this from + ** flush the cache. The hasHeldSharedLock flag prevents this from ** occurring on the very first access to a file, in order to save a ** single unnecessary sqlite3OsRead() call at the start-up. ** @@ -5170,6 +5170,7 @@ int sqlite3PagerSharedLock(Pager *pPager){ assert( pPager->eState==PAGER_OPEN ); }else{ pPager->eState = PAGER_READER; + pPager->hasHeldSharedLock = 1; } return rc; } @@ -5267,7 +5268,7 @@ int sqlite3PagerAcquire( if( pgno==0 ){ return SQLITE_CORRUPT_BKPT; } - pPager->hasBeenUsed = 1; + assert( pPager->hasHeldSharedLock==1 ); /* If the pager is in the error state, return an error immediately. ** Otherwise, request the page from the PCache layer. */ @@ -5422,7 +5423,7 @@ DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno){ assert( pgno!=0 ); assert( pPager->pPCache!=0 ); pPage = sqlite3PcacheFetch(pPager->pPCache, pgno, 0); - assert( pPage==0 || pPager->hasBeenUsed ); + assert( pPage==0 || pPager->hasHeldSharedLock ); if( pPage==0 ) return 0; return sqlite3PcacheFetchFinish(pPager->pPCache, pgno, pPage); }