From: dan Date: Thu, 5 Jul 2018 17:16:55 +0000 (+0000) Subject: In wal mode, if a "BEGIN EXCLUSIVE" command (or any other command that X-Git-Tag: version-3.25.0~170 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8bf6d705f3eaaa40b3739fdd0e38e0289da647f6;p=thirdparty%2Fsqlite.git In wal mode, if a "BEGIN EXCLUSIVE" command (or any other command that upgrades from no transaction directly to a write transaction) hits an SQLITE_BUSY_SNAPSHOT error, change the error code to SQLITE_BUSY to indicate to the caller that the condition may be transient. FossilOrigin-Name: e6108047cb136119d8ed19af010a669ed9750b4e7f991ccabc9e3d15774eda31 --- 8bf6d705f3eaaa40b3739fdd0e38e0289da647f6 diff --cc manifest index 2357a1bfd4,b888f1874b..64d53e2fec --- a/manifest +++ b/manifest @@@ -1,5 -1,5 +1,5 @@@ - C Test\sthat\sa\srace\scondition\scan\scause\sa\s"BEGIN\sEXCLUSIVE"\sto\sreturn\nSQLITE_BUSY_SNAPSHOT\sin\swal\smode. - D 2018-07-03T20:17:27.649 -C Fix\sa\stypo\sinside\san\sassert()\sstatement\sintroduced\sby\sthe\sprevious\scommit. -D 2018-07-05T17:03:43.644 ++C In\swal\smode,\sif\sa\s"BEGIN\sEXCLUSIVE"\scommand\s(or\sany\sother\scommand\sthat\nupgrades\sfrom\sno\stransaction\sdirectly\sto\sa\swrite\stransaction)\shits\san\nSQLITE_BUSY_SNAPSHOT\serror,\schange\sthe\serror\scode\sto\sSQLITE_BUSY\sto\sindicate\nto\sthe\scaller\sthat\sthe\scondition\smay\sbe\stransient. ++D 2018-07-05T17:16:55.340 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in 0a3a6c81e6fcb969ff9106e882f0a08547014ba463cb6beca4c4efaecc924ee6 @@@ -436,7 -436,7 +436,7 @@@ F src/auth.c a38f3c63c974787ecf75e3213f F src/backup.c 78d3cecfbe28230a3a9a1793e2ead609f469be43e8f486ca996006be551857ab F src/bitvec.c 17ea48eff8ba979f1f5b04cc484c7bb2be632f33 F src/btmutex.c 8acc2f464ee76324bf13310df5692a262b801808984c1b79defb2503bbafadb6 - F src/btree.c bb23e5470ec0c9b9ae8e17c86cb686bc4112642d8f457bd42b3b3727d5ef78be -F src/btree.c 757b29862c2fa6db149cf92117a6d22591bcad4b5ff1388fd480e479852a9694 ++F src/btree.c 0c27fb9b4bfd610261e2ac8956090fbf04b607b0d12bc0f1d77b6c5bf3ab3c7d F src/btree.h febb2e817be499570b7a2e32a9bbb4b607a9234f6b84bb9ae84916d4806e96f2 F src/btreeInt.h 620ab4c7235f43572cf3ac2ac8723cbdf68073be4d29da24897c7b77dda5fd96 F src/build.c 3b3bfa88800739e1f11313dcecfba5ef8e4757b6c929cdf7de9fcfc01002b81f @@@ -1745,7 -1745,7 +1745,8 @@@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a9 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 - P b6563647382634588ebe5c6a3c35c65a321dc1b3732c809d48ce46759b9dd80f - R 85d71bbec8ad4dcf2f8e9507c907b291 -P 221ff63e7902226ebf728bb7442727420636831163708f360724506ce9487ab6 -R 6292256afd58b3bdc21661c68c4c01f5 ++P 5a12db75d1da65daa92413a6b5892309e9d9479bb3610764e1015abe5bf28dbe e3357728472d5e57db6d7eef0ce008bdee071b5b07b60e242f383440eebe85bd ++R 033b09a0f95c9e18f2482abfb8812158 ++T +closed e3357728472d5e57db6d7eef0ce008bdee071b5b07b60e242f383440eebe85bd U dan - Z 38cb85199c9d8fc14bf46fba2bfb3f49 -Z 7030dc2937cfaf6aca4912e5a05c04a5 ++Z e957a80e23c286301ec669959e08c13c diff --cc manifest.uuid index e6f611aeb3,8c9534cf91..84b34c2982 --- a/manifest.uuid +++ b/manifest.uuid @@@ -1,1 -1,1 +1,1 @@@ - 5a12db75d1da65daa92413a6b5892309e9d9479bb3610764e1015abe5bf28dbe -e3357728472d5e57db6d7eef0ce008bdee071b5b07b60e242f383440eebe85bd ++e6108047cb136119d8ed19af010a669ed9750b4e7f991ccabc9e3d15774eda31 diff --cc src/btree.c index d2c580d11d,27e20e8ace..20cc3eb106 --- a/src/btree.c +++ b/src/btree.c @@@ -3375,6 -3375,6 +3375,11 @@@ int sqlite3BtreeBeginTrans(Btree *p, in rc = sqlite3PagerBegin(pBt->pPager,wrflag>1,sqlite3TempInMemory(p->db)); if( rc==SQLITE_OK ){ rc = newDatabase(pBt); ++ }else if( rc==SQLITE_BUSY_SNAPSHOT && pBt->inTransaction==TRANS_NONE ){ ++ /* if there was no transaction opened when this function was ++ ** called and SQLITE_BUSY_SNAPSHOT is returned, change the error ++ ** code to SQLITE_BUSY. */ ++ rc = SQLITE_BUSY; } } } @@@ -3424,9 -3424,17 +3429,8 @@@ } } } - }else if( rc==SQLITE_BUSY_SNAPSHOT && pBt->inTransaction==TRANS_NONE ){ - /* Even if there was no transaction opened when this function was - ** called, a race condition may cause an SQLITE_BUSY_SNAPSHOT error - ** in wal mode (since the code above opens a read-transaction and then - ** upgrades it to a write-transaction - it does not take the write lock - ** atomically). In this case change the error code to SQLITE_BUSY. */ - assert( wrflag ); - rc = SQLITE_BUSY; } -- trans_begun: if( rc==SQLITE_OK ){ if( pSchemaVersion ){