From: drh Date: Sat, 5 Oct 2019 19:53:21 +0000 (+0000) Subject: Omit the check for conflicting shared-cache locks in sqlite3Prepare() if the X-Git-Tag: version-3.31.0~432 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=705e73344ed81ea306ea6df8b94fc6b623319def;p=thirdparty%2Fsqlite.git Omit the check for conflicting shared-cache locks in sqlite3Prepare() if the database connection uses no shared cache. We might be able to go back and remove this code completely, due to the newer Schema.iGeneration logic, but that will take more analysis. This check-in gives the speed benefit but not the reduction in code size. FossilOrigin-Name: 0b73a09270dfafb27f8d1762b547ef8178c9da66f45e7153ff0b76272dfa92f5 --- diff --git a/manifest b/manifest index 360a16ff08..f14c46fbba 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Optimization\sto\ssqlite3VtabUnlockList()\sfor\sthe\scommon\scase\swhen\sthere\nis\sno\swork\sto\sdo. -D 2019-10-05T19:24:52.240 +C Omit\sthe\scheck\sfor\sconflicting\sshared-cache\slocks\sin\ssqlite3Prepare()\sif\sthe\ndatabase\sconnection\suses\sno\sshared\scache.\s\sWe\smight\sbe\sable\sto\sgo\sback\sand\nremove\sthis\scode\scompletely,\sdue\sto\sthe\snewer\sSchema.iGeneration\slogic,\sbut\nthat\swill\stake\smore\sanalysis.\s\sThis\scheck-in\sgives\sthe\sspeed\sbenefit\sbut\snot\nthe\sreduction\sin\scode\ssize. +D 2019-10-05T19:53:21.900 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -520,7 +520,7 @@ F src/pcache.h 4f87acd914cef5016fae3030343540d75f5b85a1877eed1a2a19b9f284248586 F src/pcache1.c 62714cbd1b7299a6e6a27a587b66b4fd3a836a84e1181e7f96f5c34a50917848 F src/pragma.c b47bc7db02ab13d04c680aee424466b4e34f4ef5aa7b2e464876ec005806f98f F src/pragma.h 40962d65b645bb3f08c1f4c456effd01c6e7f073f68ea25177e0c95e181cff75 -F src/prepare.c 53af23e89f42d3e5a489fc8af4449dee90fe81a1185bbb9c08567a0c814176d7 +F src/prepare.c fc245d2049e5e9e76738cd403e63c9832ff61c706d19607d2b62a51f1747609c F src/printf.c 9be6945837c839ba57837b4bc3af349eba630920fa5532aa518816defe42a7d4 F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384 F src/resolve.c e021be0c1c4a2125fa38aabcd8dbb764bf5b2c889a948c30d3708430ec6ccd00 @@ -1846,7 +1846,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 cc49380ea76a4a05843d3a0bdfb925464dc9d72c33cf5ab5243dd07d161ad038 -R 90d33cb7052902d978e92e7d394d1d19 +P fc8d45086dc2bcb9bce756088e99e63cbeedf9129139fb0e6a48b43c4f502180 +R 4347c46389181ab98e1ca993ae5d2560 U drh -Z f4e7052da6ef9e8655bcdb452b6237f4 +Z 36eb308ab97c3a3dee1bd800aab329c1 diff --git a/manifest.uuid b/manifest.uuid index 0074b1651d..fbdd95bddc 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -fc8d45086dc2bcb9bce756088e99e63cbeedf9129139fb0e6a48b43c4f502180 \ No newline at end of file +0b73a09270dfafb27f8d1762b547ef8178c9da66f45e7153ff0b76272dfa92f5 \ No newline at end of file diff --git a/src/prepare.c b/src/prepare.c index c9544fe06e..c6709a3d3d 100644 --- a/src/prepare.c +++ b/src/prepare.c @@ -601,16 +601,18 @@ static int sqlite3Prepare( ** but it does *not* override schema lock detection, so this all still ** works even if READ_UNCOMMITTED is set. */ - for(i=0; inDb; i++) { - Btree *pBt = db->aDb[i].pBt; - if( pBt ){ - assert( sqlite3BtreeHoldsMutex(pBt) ); - rc = sqlite3BtreeSchemaLocked(pBt); - if( rc ){ - const char *zDb = db->aDb[i].zDbSName; - sqlite3ErrorWithMsg(db, rc, "database schema is locked: %s", zDb); - testcase( db->flags & SQLITE_ReadUncommit ); - goto end_prepare; + if( !db->noSharedCache ){ + for(i=0; inDb; i++) { + Btree *pBt = db->aDb[i].pBt; + if( pBt ){ + assert( sqlite3BtreeHoldsMutex(pBt) ); + rc = sqlite3BtreeSchemaLocked(pBt); + if( rc ){ + const char *zDb = db->aDb[i].zDbSName; + sqlite3ErrorWithMsg(db, rc, "database schema is locked: %s", zDb); + testcase( db->flags & SQLITE_ReadUncommit ); + goto end_prepare; + } } } }