------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
-C Make\ssure\sthe\spager\scache\sis\scleared\sif\sthere\sis\sany\sdifficulty\sstarting\na\snew\sread\stransaction\sin\sWAL\smode.\s\sTicket\s[313723c356483eff2a4c4bdd2c].
-D 2010-09-18T19:36:41
+C Add\sa\stest\scase\sto\sverify\sthat\sbug\s[313723c356]\shas\sbeen\sfixed.
+D 2010-09-20T08:47:01
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in c599a15d268b1db2aeadea19df2adc3bf2eb6bee
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F test/tkt-26ff0c2d1e.test 888324e751512972c6e0d1a09df740d8f5aaf660
F test/tkt-2ea2425d34.test 1cf13e6f75d149b3209a0cb32927a82d3d79fb28
F test/tkt-31338dca7e.test 5741cd48de500347a437ba1be58c8335e83c5a5e
+F test/tkt-313723c356.test c47f8a9330523e6f35698bf4489bcb29609b53ac
F test/tkt-3fe897352e.test 10de1a67bd5c66b238a4c96abe55531b37bb4f00
F test/tkt-4a03edc4c8.test 2865e4edbc075b954daa82f8da7cc973033ec76e
F test/tkt-5e10420e8d.test 904d1687b3c06d43e5b3555bbcf6802e7c0ffd84
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P 8023a3091b32d304eaf7be41bb1d0bd33517e5f6
-R 71507bc0bee3e21d8f1063eb5b34b00d
-U drh
-Z 75f1079ea36b18df2c2f1d4f3849b1f3
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.6 (GNU/Linux)
-
-iD8DBQFMlRTMoxKgR168RlERAvt8AJ4qlP0X/B/7EIGHxORIF283C0nZ0QCfZegu
-ygy7EBpTSYM3XEOt+BtY5zQ=
-=lbvT
------END PGP SIGNATURE-----
+P e14ef0e8b4a27dbd58338214242eb3928404b176
+R c7291b56f5740f90d8dcf09aabde4142
+U dan
+Z bea42f9bac10fe0c0c7da75967ce3ee2
--- /dev/null
+# 2010 September 20
+#
+# 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.
+#
+#***********************************************************************
+# This file implements regression tests for SQLite library.
+#
+# This file implements tests to verify that ticket [313723c356] has been
+# fixed.
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+source $testdir/malloc_common.tcl
+
+ifcapable !wal { finish_test ; return }
+
+do_execsql_test tkt-313723c356.1 {
+ PRAGMA page_size = 1024;
+ PRAGMA journal_mode = WAL;
+ CREATE TABLE t1(a, b);
+ CREATE INDEX i1 ON t1(a, b);
+ INSERT INTO t1 VALUES(randomblob(400), randomblob(400));
+ INSERT INTO t1 SELECT randomblob(400), randomblob(400) FROM t1;
+ INSERT INTO t1 SELECT randomblob(400), randomblob(400) FROM t1;
+ INSERT INTO t1 SELECT randomblob(400), randomblob(400) FROM t1;
+ INSERT INTO t1 SELECT randomblob(400), randomblob(400) FROM t1;
+} {wal}
+faultsim_save_and_close
+
+do_faultsim_test tkt-313723c356.2 -faults shmerr* -prep {
+ faultsim_restore_and_reopen
+ sqlite3 db2 test.db
+ db eval { SELECT * FROM t1 }
+ db2 eval { UPDATE t1 SET a = randomblob(399) }
+ db2 close
+} -body {
+ # At this point, the cache contains all of table t1 and none of index i1. The
+ # cache is out of date. When the bug existed and the right xShmLock() fails
+ # in the following statement, the internal cache of the WAL header was
+ # being updated, but the contents of the page-cache not flushed. This causes
+ # the integrity-check in the "-test" code to fail, as it is comparing the
+ # cached (out-of-date) version of table t1 with the on disk (up-to-date)
+ # version of index i1.
+ #
+ execsql { SELECT min(rowid) FROM t1 }
+} -test {
+ faultsim_test_result {0 1}
+ faultsim_integrity_check
+}
+
+finish_test