From 986fbb8e30426dd46de26003f756583471d9b0bc Mon Sep 17 00:00:00 2001 From: danielk1977 Date: Sat, 28 Jun 2008 15:33:24 +0000 Subject: [PATCH] Remove an assert() that was failing if there were any open incremental blob handles when a statement transaction was rolled back. (CVS 5326) FossilOrigin-Name: f66491ab2ba3645d4e44e33ec6fa0ab94b2989be --- manifest | 16 ++++++------ manifest.uuid | 2 +- src/btree.c | 3 +-- test/incrblob2.test | 60 +++++++++++++++++++++++++++++++++++++++------ 4 files changed, 63 insertions(+), 18 deletions(-) diff --git a/manifest b/manifest index 1466da2c96..343630ee04 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Added\sreminder\smessage\sto\sterminate\sSQL\sstatements\swith\sa\ssemicolon\son\sshell\sstartup.\sThis\scloses\s#3099.\s(CVS\s5325) -D 2008-06-28T11:29:23 +C Remove\san\sassert()\sthat\swas\sfailing\sif\sthere\swere\sany\sopen\sincremental\sblob\shandles\swhen\sa\sstatement\stransaction\swas\srolled\sback.\s(CVS\s5326) +D 2008-06-28T15:33:25 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 325dfac0a0dd1cb4d975f1ace6453157892e6042 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -95,7 +95,7 @@ F src/attach.c b18ba42c77f7d3941f5d23d2ca20fa1d841a4e91 F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627 F src/bitvec.c 95c86bd18d8fedf0533f5af196192546e10a7e7d F src/btmutex.c 483ced3c52205b04b97df69161fadbf87f4f1ea2 -F src/btree.c 6d25027de7c26b1c0a69ad3f2045f944e20fba22 +F src/btree.c dd7b7a92fe9a0e950279e86a771bb522adb6a86b F src/btree.h b1bd7e0b8c2e33658aaf447cb0d1d94f74664b6b F src/btreeInt.h 02325f04758dba0fcd0c08ac55cd9b189dad61a5 F src/build.c 88cc5501a87f72d0538b040001d88d31f994edea @@ -339,7 +339,7 @@ F test/in.test b35fc31caf26647cc4243c3af8ad29e45ed8776f F test/in2.test b1f447f4f0f67e9f83ff931e7e2e30873f9ea055 F test/in3.test dc62b080ed79898121c61c91118b4d1e111f1438 F test/incrblob.test 4455fffd08b2f9418a9257e18b135d72273eff3e -F test/incrblob2.test c9aad1e11f7726d8c49e66f2a1ecc2d04f9f6861 +F test/incrblob2.test c82a780356bdf4d0c77f1adf0ea888248904fc07 F test/incrblob_err.test a3e3d9442d2993e8a449e791db4001d11a2f683f F test/incrvacuum.test 1a2b0bddc76629afeb41e3d8ea3e4563982d16b9 F test/incrvacuum2.test 46ef65f377e3937cfd1ba66e818309dab46f590d @@ -595,7 +595,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e -P f70d552bcd0df884eea2e2272bae558d35fc8845 -R b56dbc14c80164265b31dc6aa6cdea26 -U mihailim -Z 2ab945c575514f69295f259ec8109260 +P 0ab0b030dea03ec6693358b733329328828cf802 +R 8c25ea2dec6b6961f92bbdeafaa47650 +U danielk1977 +Z 103f0194a9136d291f48c62f781a1953 diff --git a/manifest.uuid b/manifest.uuid index 21d2b9f144..bc52ef9272 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0ab0b030dea03ec6693358b733329328828cf802 \ No newline at end of file +f66491ab2ba3645d4e44e33ec6fa0ab94b2989be \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index 1a6350d118..f704baebcc 100644 --- a/src/btree.c +++ b/src/btree.c @@ -9,7 +9,7 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* -** $Id: btree.c,v 1.469 2008/06/23 09:50:51 danielk1977 Exp $ +** $Id: btree.c,v 1.470 2008/06/28 15:33:25 danielk1977 Exp $ ** ** This file implements a external (disk-based) database using BTrees. ** See the header comment on "btreeInt.h" for additional information. @@ -2690,7 +2690,6 @@ int sqlite3BtreeRollbackStmt(Btree *p){ pBt->db = p->db; if( pBt->inStmt && !pBt->readOnly ){ rc = sqlite3PagerStmtRollback(pBt->pPager); - assert( countWriteCursors(pBt)==0 ); pBt->inStmt = 0; } sqlite3BtreeLeave(p); diff --git a/test/incrblob2.test b/test/incrblob2.test index 7757930b49..90295e8a37 100644 --- a/test/incrblob2.test +++ b/test/incrblob2.test @@ -12,7 +12,7 @@ # Test that it is possible to have two open blob handles on a single # blob object. # -# $Id: incrblob2.test,v 1.7 2008/06/26 18:04:03 danielk1977 Exp $ +# $Id: incrblob2.test,v 1.8 2008/06/28 15:33:26 danielk1977 Exp $ # set testdir [file dirname $argv0] @@ -353,11 +353,57 @@ do_test incrblob2-7.5 { close $h } {} -#do_test incrblob2-8.5 { - #execsql BEGIN - #db eval {SELECT * FROM t2} { - #execsql "DROP TABLE t2" - #} -#} {} +#--------------------------------------------------------------------------- +# The following tests, incrblob2-8.*, test that nothing terrible happens +# when a statement transaction is rolled back while there are open +# incremental-blob handles. At one point an assert() was failing when +# this was attempted. +# +do_test incrblob2-8.1 { + execsql BEGIN + set h [db incrblob t2 B 1] + set rc [catch { + db eval {SELECT * FROM t2} { execsql "DROP TABLE t2" } + } msg] + list $rc $msg +} {1 {database table is locked}} +do_test incrblob2-8.2 { + close $h + execsql COMMIT +} {} +do_test incrblob2-8.3 { + execsql { + CREATE TABLE t3(a INTEGER UNIQUE, b TEXT); + INSERT INTO t3 VALUES(1, 'aaaaaaaaaaaaaaaaaaaa'); + INSERT INTO t3 VALUES(2, 'bbbbbbbbbbbbbbbbbbbb'); + INSERT INTO t3 VALUES(3, 'cccccccccccccccccccc'); + INSERT INTO t3 VALUES(4, 'dddddddddddddddddddd'); + INSERT INTO t3 VALUES(5, 'eeeeeeeeeeeeeeeeeeee'); + } +} {} +do_test incrblob2-8.4 { + execsql BEGIN + set h [db incrblob t3 b 3] + sqlite3_blob_read $h 0 20 +} {cccccccccccccccccccc} +do_test incrblob2-8.5 { + catchsql {UPDATE t3 SET a = 6 WHERE a > 3} +} {1 {column a is not unique}} +do_test incrblob2-8.6 { + catchsql {UPDATE t3 SET a = 6 WHERE a > 3} +} {1 {column a is not unique}} +do_test incrblob2-8.7 { + sqlite3_blob_read $h 0 20 +} {cccccccccccccccccccc} +do_test incrblob2-8.8 { + catchsql {UPDATE t3 SET a = 6 WHERE a = 3 OR a = 5} +} {1 {column a is not unique}} +do_test incrblob2-8.9 { + set rc [catch {sqlite3_blob_read $h 0 20} msg] + list $rc $msg +} {1 SQLITE_ABORT} +do_test incrblob2-8.X { + close $h +} {} finish_test