From: dan Date: Mon, 17 Aug 2009 09:29:09 +0000 (+0000) Subject: Add a test to verify that 3.6.17 releases read-locks obtained to read the database... X-Git-Tag: fts3-refactor~262 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d768f944d999f5fcf75fcc6b2c61b998a4dfb3cd;p=thirdparty%2Fsqlite.git Add a test to verify that 3.6.17 releases read-locks obtained to read the database schema even if the connection is not currently in auto-commit mode. FossilOrigin-Name: 78dfe8321db9debfcd4a7f3daf4223d0cbf23ab9 --- diff --git a/manifest b/manifest index 63dec38152..39d7c19418 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,5 @@ ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA1 - -C Update\sthe\samalgamation\sbuilder\sso\sthat\sit\savoids\sputting\sredundant\nSQLITE_API\smacros\son\sdeclarations. -D 2009-08-14T18:18:04 +C Add\sa\stest\sto\sverify\sthat\s3.6.17\sreleases\sread-locks\sobtained\sto\sread\sthe\sdatabase\sschema\seven\sif\sthe\sconnection\sis\snot\scurrently\sin\sauto-commit\smode. +D 2009-08-17T09:29:09 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 0f7761c5d1c62ae7a841e3393ffaff1fa0f5c00a F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -447,6 +444,7 @@ F test/lock3.test f271375930711ae044080f4fe6d6eda930870d00 F test/lock4.test f4f36271aa5ae1da449646bf43c7341f6b2b4c4e F test/lock5.test 6b1f78f09ad1522843dad571b76b321e6f439bf7 F test/lock6.test 862aa71e97b288d6b3f92ba3313f51bd0b003776 +F test/lock7.test 64006c84c1c616657e237c7ad6532b765611cf64 F test/lookaside.test 1dd350dc6dff015c47c07fcc5a727a72fc5bae02 F test/main.test 347ab987f16167858781383427476b33dc69fdb7 F test/make-where7.tcl 05c16b5d4f5d6512881dfec560cb793915932ef9 @@ -746,14 +744,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746 -P 9cbe3654055a78c09ea1ecd5dc599bcd888b57e3 -R 9142cd5088584d6322dd160e9df9a386 -U drh -Z 2a7604fcf5cc328cdfa6d300890f778c ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1.4.6 (GNU/Linux) - -iD8DBQFKhapgoxKgR168RlERAkH2AJoC/gxQtUL74VspfOFK2+qp6iCVFQCfRUDA -GwXZvHleDts/BZKq+4hsve0= -=Wsj5 ------END PGP SIGNATURE----- +P 0d5b058717858c9cda8ca120a3d814453a94a0e6 +R 21fd0dcb0488b2f1e8b12f7c75a25ab9 +U dan +Z 8c3d02897968f0c8db675a4b60c055a9 diff --git a/manifest.uuid b/manifest.uuid index 82fd998483..e7f37cb88e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0d5b058717858c9cda8ca120a3d814453a94a0e6 \ No newline at end of file +78dfe8321db9debfcd4a7f3daf4223d0cbf23ab9 \ No newline at end of file diff --git a/test/lock7.test b/test/lock7.test new file mode 100644 index 0000000000..49bc147a22 --- /dev/null +++ b/test/lock7.test @@ -0,0 +1,61 @@ +# 2009 August 17 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# +# Check that reading the database schema from within an active transaction +# does not establish a SHARED lock on the database file if one is not +# already held (or, more accurately, that the SHARED lock is released after +# reading the database schema). +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +do_test lock7-1.1 { + execsql { CREATE TABLE t1(a, b) } + db close + + sqlite3 db1 test.db + sqlite3 db2 test.db + + db1 eval {BEGIN} + db2 eval {BEGIN} +} {} + +do_test lock7-1.2 { + execsql { PRAGMA lock_status } db1 +} {main unlocked temp closed} +do_test lock7-1.3 { + execsql { PRAGMA lock_status } db2 +} {main unlocked temp closed} + +do_test lock7-1.4 { + catchsql { INSERT INTO t1 VALUES(1, 1) } db1 +} {0 {}} +do_test lock7-1.5 { + catchsql { INSERT INTO t1 VALUES(2, 2) } db2 +} {1 {database is locked}} + +do_test lock7-1.6 { + execsql { PRAGMA lock_status } db1 +} {main reserved temp closed} +do_test lock7-1.7 { + execsql { PRAGMA lock_status } db2 +} {main unlocked temp closed} + +do_test lock7-1.8 { + execsql { COMMIT } db1 +} {} + +db1 close +db2 close + +finish_test +