From: drh Date: Mon, 31 May 2010 13:11:49 +0000 (+0000) Subject: Change WAL test cases to account for the improved concurrency in the new X-Git-Tag: version-3.7.2~328^2~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a2ac9df170f8ab8040e3661a98d26e58a789d2b6;p=thirdparty%2Fsqlite.git Change WAL test cases to account for the improved concurrency in the new checkpoint logic. FossilOrigin-Name: 2d6f2485053e6d2a67abda9a80693ca68f4556d2 --- diff --git a/manifest b/manifest index 48d287f576..2b082de5a0 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -C Do\snot\sfail\sa\scheckpoint\sjust\sbecause\sactive\sreaders\sprevent\sbackfill. -D 2010-05-31T12:30:52 +C Change\sWAL\stest\scases\sto\saccount\sfor\sthe\simproved\sconcurrency\sin\sthe\snew\ncheckpoint\slogic. +D 2010-05-31T13:11:49 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in a5cad1f8f3e021356bfcc6c77dc16f6f1952bbc3 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -764,7 +764,7 @@ F test/vtabE.test 7c4693638d7797ce2eda17af74292b97e705cc61 F test/vtab_alter.test 9e374885248f69e251bdaacf480b04a197f125e5 F test/vtab_err.test 0d4d8eb4def1d053ac7c5050df3024fd47a3fbd8 F test/vtab_shared.test 0eff9ce4f19facbe0a3e693f6c14b80711a4222d -F test/wal.test b965dc2509515a7758016cbec398ea4b1ff5424a +F test/wal.test 24fb9f0e7eb7fc30b6ae216d59e31a6a21648b07 F test/wal2.test c58bb5b2fac48b8393909038ced730df5ad973b0 F test/walbak.test e7650a26eb4b8abeca9b145b1af1e63026dde432 F test/walcksum.test 4efa8fb88c32bed8288ea4385a9cc113a5c8f0bf @@ -818,14 +818,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 765c33181a7b9d99b452ce750d69f217b3c81a5d -R 1e19bec8e3b7c1b6a9925e13022fc48f +P 9aa4243e0cedcc9204994d04af1b2b7a80c048bd +R 72bbbb4220e5d5ecf9016be13b6d8c95 U drh -Z c22021b716c64e3ce3cd89536f71c5b9 +Z dd48911da91c10eed857c9b8bf3a4d73 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) -iD8DBQFMA6wAoxKgR168RlERAqR7AJ9WJJ/VHv5q/R1C70ZExZQHh/d9XQCfVqlC -ZdxZW50cpNVzLpKcKSRyJHU= -=weXO +iD8DBQFMA7WYoxKgR168RlERAkmEAKCAGuXlAbCYwPqWoxSSXRviFrwEIQCgiNnx +saabtRhlvE/VE/M4AMJEkvk= +=fgRj -----END PGP SIGNATURE----- diff --git a/manifest.uuid b/manifest.uuid index 1bd46b4f0d..b36d9eaa98 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9aa4243e0cedcc9204994d04af1b2b7a80c048bd \ No newline at end of file +2d6f2485053e6d2a67abda9a80693ca68f4556d2 \ No newline at end of file diff --git a/test/wal.test b/test/wal.test index 27a9a7b17d..de783088be 100644 --- a/test/wal.test +++ b/test/wal.test @@ -583,48 +583,37 @@ foreach code [list { catchsql { PRAGMA wal_checkpoint } } {0 {}} - # Similar to the test above. Except this time, a new read transaction is - # started (db3) while the checkpointer is waiting for an old one (db2) to - # finish. The checkpointer can finish, but any subsequent write operations - # must wait until after db3 has closed the read transaction, as db3 is a - # "region D" writer. + # The following series of test cases used to verify another blocking + # case in WAL - a case which no longer blocks. # do_test wal-10.$tn.15 { sql2 { COMMIT; BEGIN; SELECT * FROM t1; } } {1 2 3 4 5 6 7 8 9 10 11 12} do_test wal-10.$tn.16 { catchsql { PRAGMA wal_checkpoint } - } {1 {database is locked}} - proc busyhandler x { - if {$x==3} { sql3 { BEGIN; SELECT * FROM t1 } } - if {$x==4} { sql2 COMMIT } - if {$x<5} { return 0 } - return 1 - } - db busy busyhandler + } {0 {}} do_test wal-10.$tn.17 { execsql { PRAGMA wal_checkpoint } } {} do_test wal-10.$tn.18 { - sql3 { SELECT * FROM t1 } + sql3 { BEGIN; SELECT * FROM t1 } } {1 2 3 4 5 6 7 8 9 10 11 12} do_test wal-10.$tn.19 { catchsql { INSERT INTO t1 VALUES(13, 14) } - } {1 {database is locked}} + } {0 {}} do_test wal-10.$tn.20 { execsql { SELECT * FROM t1 } - } {1 2 3 4 5 6 7 8 9 10 11 12} + } {1 2 3 4 5 6 7 8 9 10 11 12 13 14} do_test wal-10.$tn.21 { sql3 COMMIT + sql2 COMMIT } {} do_test wal-10.$tn.22 { - execsql { INSERT INTO t1 VALUES(13, 14) } execsql { SELECT * FROM t1 } } {1 2 3 4 5 6 7 8 9 10 11 12 13 14} - # Set [db3] up as a "region D" reader again. Then upgrade it to a writer - # and back down to a reader. Then, check that a checkpoint is not possible - # (as [db3] still has a snapshot locked). + # Another series of tests that used to demonstrate blocking behavior + # but which now work. # do_test wal-10.$tn.23 { execsql { PRAGMA wal_checkpoint } @@ -637,23 +626,21 @@ foreach code [list { } {} do_test wal-10.$tn.26 { catchsql { INSERT INTO t1 VALUES(15, 16) } - } {1 {database is locked}} + } {0 {}} do_test wal-10.$tn.27 { - sql3 { INSERT INTO t1 VALUES(15, 16) } + sql3 { INSERT INTO t1 VALUES(17, 18) } } {} do_test wal-10.$tn.28 { code3 { set ::STMT [sqlite3_prepare db3 "SELECT * FROM t1" -1 TAIL] sqlite3_step $::STMT } - sql3 COMMIT execsql { SELECT * FROM t1 } - } {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16} - db busy {} + } {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18} do_test wal-10.$tn.29 { - execsql { INSERT INTO t1 VALUES(17, 18) } + execsql { INSERT INTO t1 VALUES(19, 20) } catchsql { PRAGMA wal_checkpoint } - } {1 {database is locked}} + } {0 {}} do_test wal-10.$tn.30 { code3 { sqlite3_finalize $::STMT } execsql { PRAGMA wal_checkpoint } @@ -664,20 +651,21 @@ foreach code [list { # Test that this bug has been fixed. # do_test wal-10.$tn.31 { + sql2 COMMIT execsql { BEGIN ; SELECT * FROM t1 } - sql2 { INSERT INTO t1 VALUES(19, 20) } - catchsql { INSERT INTO t1 VALUES(21, 22) } + sql2 { INSERT INTO t1 VALUES(21, 22) } + catchsql { INSERT INTO t1 VALUES(23, 24) } } {1 {database is locked}} do_test wal-10.$tn.32 { # This statement would fail when the bug was present. - sql2 { INSERT INTO t1 VALUES(21, 22) } + sql2 { INSERT INTO t1 VALUES(23, 24) } } {} do_test wal-10.$tn.33 { execsql { SELECT * FROM t1 ; COMMIT } - } {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18} + } {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20} do_test wal-10.$tn.34 { execsql { SELECT * FROM t1 } - } {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22} + } {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24} # Test that if a checkpointer cannot obtain the required locks, it # releases all locks before returning a busy error. @@ -693,11 +681,9 @@ foreach code [list { SELECT * FROM t1; } } {a b c d} - proc busyhandler x { return 1 } - db busy busyhandler do_test wal-10.$tn.36 { catchsql { PRAGMA wal_checkpoint } - } {1 {database is locked}} + } {0 {}} do_test wal-10.$tn.36 { sql3 { INSERT INTO t1 VALUES('e', 'f') } sql2 { SELECT * FROM t1 }