]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add another test case to tkt35xx.test showing that a statement rollback can also...
authordanielk1977 <danielk1977@noemail.net>
Fri, 21 Nov 2008 08:50:50 +0000 (08:50 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Fri, 21 Nov 2008 08:50:50 +0000 (08:50 +0000)
FossilOrigin-Name: 74c08b8dd9577d1997b4bc8147beed786150f22b

manifest
manifest.uuid
test/tkt35xx.test

index a683cb3b8fcae4ef654b256c47e9697808e31feb..aa5af2f985372f77dea40587a8b38f82dbb4cf9f 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C On\sa\sROLLBACK,\sif\sthere\spage\scache\sentries\swhich\sare\sdirty\sbut\snot\sin\sthe\nrollback\sjournal,\smake\ssure\sthey\sget\sreinitialized\sin\sthe\sbtree\slayer.\s(CVS\s5936)
-D 2008-11-21T03:23:43
+C Add\sanother\stest\scase\sto\stkt35xx.test\sshowing\sthat\sa\sstatement\srollback\scan\salso\strigger\sthe\sproblem.\s(CVS\s5937)
+D 2008-11-21T08:50:50
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in 0aa7bbe3be6acc4045706e3bb3fd0b8f38f4a3b5
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -581,7 +581,7 @@ F test/tkt3457.test e9ca2b90f0eb1fb8be73a30d29aacb2e3abedeb9
 F test/tkt3461.test 5a63e8d8ee5ce00f076b1e2f82aba5480a0f14ed
 F test/tkt3472.test e689a687631e59c7a47d9438148115fee23b16c3
 F test/tkt3493.test 8472b3464e49a27ff7271308eec46154209e667b
-F test/tkt35xx.test 7bad910326076e1147b56717a436a68c9d5a227a
+F test/tkt35xx.test 0519cbf85a5531e30177bfb58ff94238a9972ef3
 F test/tokenize.test ce430a7aed48fc98301611429595883fdfcab5d7
 F test/trace.test 951cd0f5f571e7f36bf7bfe04be70f90fb16fb00
 F test/trans.test 2fd24cd7aa0b879d49a224cbd647d698f1e7ac5c
@@ -661,7 +661,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 6f910b7036817f4bb4de807bf48938d20ab033cc
-R 07e73e1f53ea5064ce74d8b65c948f50
-U drh
-Z 8e850a75352c5d8dd456f4d89f060e1a
+P faded96f36229ee85039276db693391d0f10648c
+R 3f6a31e8be46dea16b333ede4095e47c
+U danielk1977
+Z 06fd4a309d695ebc1047a668a58696a1
index da2be48dad963a884d83a90cc9304a95bfb74e9c..4408ebf272680d18f7d95085a3941c84e8949fe0 100644 (file)
@@ -1 +1 @@
-faded96f36229ee85039276db693391d0f10648c
\ No newline at end of file
+74c08b8dd9577d1997b4bc8147beed786150f22b
\ No newline at end of file
index 4cbb2e92fbb400a492677730876e6897d687ab0a..e9ca785a0eb14696c4820c363e08c01e20d92421 100644 (file)
 # page cache which are not in the rollback journal are reinitialized
 # in the btree layer.
 #
-# $Id: tkt35xx.test,v 1.1 2008/11/21 03:23:43 drh Exp $
+# $Id: tkt35xx.test,v 1.2 2008/11/21 08:50:50 danielk1977 Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
 
+do_test tkt35xx-1.1 {
+  execsql {
+    PRAGMA auto_vacuum = 0;
+    PRAGMA page_size = 1024;
+  }
+} {}
+
+# Trigger the problem using explicit rollback.
+#
 do_test tkt35xx-1.1 {
   execsql {
     PRAGMA auto_vacuum = 0;
@@ -37,3 +46,61 @@ do_test tkt35xx-1.1 {
     INSERT INTO t1 VALUES(1, 1, zeroblob(676));
   }
 } {}
+
+# Trigger the problem using statement rollback.
+#
+db close
+file delete test.db
+sqlite3 db test.db
+set big [string repeat abcdefghij 22]    ;# 220 byte string
+do_test tkt35xx-1.2.1 {
+  execsql {
+    PRAGMA auto_vacuum = 0;
+    PRAGMA page_size = 1024;
+    CREATE TABLE t3(a INTEGER PRIMARY KEY, b);
+    INSERT INTO t3 VALUES(1, $big);
+    INSERT INTO t3 VALUES(2, $big);
+    INSERT INTO t3 VALUES(3, $big);
+    INSERT INTO t3 VALUES(4, $big);
+    CREATE TABLE t4(c, d);
+    INSERT INTO t4 VALUES(5, $big);
+    INSERT INTO t4 VALUES(1, $big);
+  }
+} {}
+do_test tkt35xx-1.2.2 {
+  catchsql {
+    BEGIN;
+    CREATE TABLE t5(e PRIMARY KEY, f);
+    DROP TABLE t5;
+    INSERT INTO t3(a, b) SELECT c, d FROM t4;
+  }
+} {1 {PRIMARY KEY must be unique}}
+
+do_test tkt35xx-1.2.3 {
+  # Show that the transaction has not been rolled back.
+  catchsql BEGIN
+} {1 {cannot start a transaction within a transaction}}
+
+# Before the bug was fixed, if SQLITE_DEBUG was defined an assert()
+# would fail during the following INSERT statement. If SQLITE_DEBUG
+# was not defined, then the statement would pass and the transaction
+# would be committed. But, the "SELECT count(*)" in tkt35xx-1.2.6 would
+# return 1, not 5. Data magically disappeared!
+#
+do_test tkt35xx-1.2.4 {
+  execsql { SELECT count(*) FROM t3 }
+} {4}
+do_test tkt35xx-1.2.5 {
+  execsql { 
+    INSERT INTO t3 VALUES(5, $big);
+    COMMIT;
+  }
+} {}
+do_test tkt35xx-1.2.6 {
+  execsql { SELECT count(*) FROM t3 }
+} {5}
+
+integrity_check tkt35xx-1.2.7
+
+finish_test
+