-C Merge\slatest\strunk\schanges\sinto\sthis\sbranch.
-D 2017-10-06T14:25:25.410
+C Check\sin\stest\sfile\swal2simple.test.
+D 2017-10-07T13:37:04.814
F Makefile.in 4bc36d913c2e3e2d326d588d72f618ac9788b2fd4b7efda61102611a6495c3ff
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 6033b51b6aea702ea059f6ab2d47b1d3cef648695f787247dd4fb395fe60673f
F test/wal.test 613efec03e517e1775d86b993a54877d2e29a477
F test/wal2.test 6ac39b94a284ebac6efb6be93b0cdfe73ee6083f129555e3144d8a615e9900ef
F test/wal2rewrite.test 6ca6f631ffcf871240beab5f02608913fd075c6d0d31310b026c8383c65c9f9c
+F test/wal2simple.test 7ea5b2bfedace701a6415d27ecac7bcd852381435b6f3d71bb90eda0db11b2b9
F test/wal3.test 2a93004bc0fb2b5c29888964024695bade278ab2
F test/wal4.test 4744e155cd6299c6bd99d3eab1c82f77db9cdb3c
F test/wal5.test 9c11da7aeccd83a46d79a556ad11a18d3cb15aa9
F test/walshared.test 0befc811dcf0b287efae21612304d15576e35417
F test/walslow.test c05c68d4dc2700a982f89133ce103a1a84cc285f
F test/walthread.test de8dbaf6d9e41481c460ba31ca61e163d7348f8e
-F test/waltwo2.test 6e4d36500a20ff2d19761cf0e9a5d178e83d1798feda157ebc0681e01a35e56e
F test/where.test f0c325563acde44f2c4ea6ba348e9e29f7121757
F test/where2.test 478d2170637b9211f593120648858593bf2445a1
F test/where3.test 54cdeb02157acc979de41530b804ae7b09552bf1
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 9e1502e1b650217efc361732a3dfe686caa2e6352d040c73865f1faf09bf4591 8ca0fa8dfe6a66aea7fc63f15e6f704cb190aa0760a3fec2db5f6bad3861a135
-R 8c191757c669656683c7e7d83493c86d
+P 7e43517861d4ecfa86766a16a2c721377b75da78771d5ba18870dcb9626a8dce
+R efd9b7af2079a6949a0d309021efe433
U dan
-Z b9f86bb91f1032f49d3cb4702444cf0c
+Z 3fd52f62c898d986eaf1742529c99b05
--- /dev/null
+# 2017 September 19
+#
+# 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. The
+# focus of this file is testing the operation of the library in
+# "PRAGMA journal_mode=WAL2" mode.
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+source $testdir/lock_common.tcl
+source $testdir/malloc_common.tcl
+source $testdir/wal_common.tcl
+
+set testprefix wal2simple
+ifcapable !wal {finish_test ; return }
+
+#-------------------------------------------------------------------------
+# The following tests verify that a client can switch in and out of wal
+# and wal2 mode. But that it is not possible to change directly from wal
+# to wal2, or from wal2 to wal mode.
+#
+do_execsql_test 1.1.0 {
+ PRAGMA journal_mode = wal2
+} {wal2}
+execsql { SELECT * FROM sqlite_master}
+do_execsql_test 1.x {
+ PRAGMA journal_mode;
+ PRAGMA main.journal_mode;
+} {wal2 wal2}
+db close
+do_test 1.1.1 { file size test.db } {1024}
+do_test 1.1.2 { hexio_read test.db 18 2 } 0303
+
+sqlite3 db test.db
+do_execsql_test 1.2.0 {
+ SELECT * FROM sqlite_master;
+ PRAGMA journal_mode = delete;
+} {delete}
+db close
+do_test 1.2.1 { file size test.db } {1024}
+do_test 1.2.2 { hexio_read test.db 18 2 } 0101
+
+sqlite3 db test.db
+do_execsql_test 1.3.0 {
+ SELECT * FROM sqlite_master;
+ PRAGMA journal_mode = wal;
+} {wal}
+db close
+do_test 1.3.1 { file size test.db } {1024}
+do_test 1.3.2 { hexio_read test.db 18 2 } 0202
+
+sqlite3 db test.db
+do_catchsql_test 1.4.0 {
+ PRAGMA journal_mode = wal2;
+} {1 {cannot change from wal to wal2 mode}}
+do_execsql_test 1.4.1 {
+ PRAGMA journal_mode = wal;
+ PRAGMA journal_mode = delete;
+ PRAGMA journal_mode = wal2;
+ PRAGMA journal_mode = wal2;
+} {wal delete wal2 wal2}
+do_catchsql_test 1.4.2 {
+ PRAGMA journal_mode = wal;
+} {1 {cannot change from wal2 to wal mode}}
+db close
+do_test 1.4.3 { hexio_read test.db 18 2 } 0303
+
+#-------------------------------------------------------------------------
+# Test that recovery in wal2 mode works.
+#
+forcedelete test.db test.db-wal test.db-wal2
+reset_db
+do_execsql_test 2.0 {
+ CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
+ PRAGMA journal_mode = wal2;
+ PRAGMA journal_size_limit = 5000;
+} {wal2 5000}
+
+proc wal_hook {DB nm nFrame} { $DB eval { PRAGMA wal_checkpoint } }
+db wal_hook {wal_hook db}
+
+for {set i 1} {$i <= 200} {incr i} {
+ execsql { INSERT INTO t1 VALUES(NULL, randomblob(100)) }
+ set res [db eval { SELECT sum(a), md5sum(b) FROM t1 }]
+
+ do_test 2.1.$i {
+ foreach f [glob -nocomplain test.db2*] { forcedelete $f }
+ forcecopy test.db test.db2
+ forcecopy test.db-wal test.db2-wal
+ forcecopy test.db-wal2 test.db2-wal2
+
+ sqlite3 db2 test.db2
+ db2 eval { SELECT sum(a), md5sum(b) FROM t1 }
+ } $res
+
+ db2 close
+}
+
+#-------------------------------------------------------------------------
+
+reset_db
+do_execsql_test 3.0 {
+ CREATE TABLE t1(x BLOB, y INTEGER PRIMARY KEY);
+ CREATE INDEX i1 ON t1(x);
+ PRAGMA cache_size = 5;
+ PRAGMA journal_mode = wal2;
+} {wal2}
+
+do_test 3.1 {
+ execsql BEGIN
+ for {set i 1} {$i < 1000} {incr i} {
+ execsql { INSERT INTO t1 VALUES(randomblob(800), $i) }
+ }
+ execsql COMMIT
+} {}
+
+do_execsql_test 3.2 {
+ PRAGMA integrity_check;
+} {ok}
+
+#-------------------------------------------------------------------------
+catch { db close }
+foreach f [glob -nocomplain test.db*] { forcedelete $f }
+reset_db
+do_execsql_test 4.0 {
+ CREATE TABLE t1(x, y);
+ PRAGMA journal_mode = wal2;
+} {wal2}
+
+do_execsql_test 4.1 {
+ SELECT * FROM t1;
+} {}
+
+do_execsql_test 4.2 {
+ INSERT INTO t1 VALUES(1, 2);
+} {}
+
+do_execsql_test 4.3 {
+ SELECT * FROM t1;
+} {1 2}
+
+do_test 4.4 {
+ sqlite3 db2 test.db
+ execsql { SELECT * FROM t1 } db2
+} {1 2}
+
+do_test 4.5 {
+ lsort [glob test.db*]
+} {test.db test.db-shm test.db-wal test.db-wal2}
+
+do_test 4.6 {
+ db close
+ db2 close
+ sqlite3 db test.db
+ execsql { SELECT * FROM t1 }
+} {1 2}
+
+do_execsql_test 4.7 {
+ PRAGMA journal_size_limit = 4000;
+ INSERT INTO t1 VALUES(3, 4);
+ INSERT INTO t1 VALUES(5, 6);
+ INSERT INTO t1 VALUES(7, 8);
+ INSERT INTO t1 VALUES(9, 10);
+ INSERT INTO t1 VALUES(11, 12);
+ INSERT INTO t1 VALUES(13, 14);
+ INSERT INTO t1 VALUES(15, 16);
+ INSERT INTO t1 VALUES(17, 18);
+ SELECT * FROM t1;
+} {4000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18}
+
+do_test 4.8 {
+ sqlite3 db2 test.db
+ execsql { SELECT * FROM t1 } db2
+} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18}
+
+do_test 4.9 {
+ db close
+ db2 close
+ lsort [glob test.db*]
+} {test.db}
+
+#-------------------------------------------------------------------------
+reset_db
+do_execsql_test 5.0 {
+ CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c);
+ CREATE INDEX i1 ON t1(b, c);
+ PRAGMA journal_mode = wal2;
+ PRAGMA journal_size_limit = 4000;
+} {wal2 4000}
+
+proc wal_hook {DB nm nFrame} {
+ $DB eval { PRAGMA wal_checkpoint }
+}
+db wal_hook [list wal_hook db]
+
+
+foreach js {4000 8000 12000} {
+ foreach NROW [list 100 200 300 400 500 600 1000] {
+ do_test 5.$js.$NROW.1 {
+ db eval "DELETE FROM t1"
+ db eval "PRAGMA journal_size_limit = $js"
+ set nTotal 0
+ for {set i 0} {$i < $NROW} {incr i} {
+ db eval { INSERT INTO t1 VALUES($i, $i, randomblob(abs(random()%50))) }
+ incr nTotal $i
+ }
+ set {} {}
+ } {}
+
+ do_test 5.$js.$NROW.2 {
+ sqlite3 db2 test.db
+ db2 eval {
+ PRAGMA integrity_check;
+ SELECT count(*), sum(b) FROM t1;
+ }
+ } [list ok $NROW $nTotal]
+
+ db2 close
+ }
+}
+
+
+
+
+finish_test
+++ /dev/null
-# 2017 September 19
-#
-# 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. The
-# focus of this file is testing the operation of the library in
-# "PRAGMA journal_mode=WAL2" mode.
-#
-
-set testdir [file dirname $argv0]
-source $testdir/tester.tcl
-source $testdir/lock_common.tcl
-source $testdir/malloc_common.tcl
-source $testdir/wal_common.tcl
-
-set testprefix walsimple
-ifcapable !wal {finish_test ; return }
-
-db close
-foreach f [glob -nocomplain test.db*] { forcedelete $f }
-sqlite3 db test.db
-
-do_execsql_test 1.0 {
- CREATE TABLE t1(x, y);
- PRAGMA journal_mode = wal2;
-} {wal2}
-
-do_execsql_test 1.1 {
- SELECT * FROM t1;
-} {}
-
-do_execsql_test 1.2 {
- INSERT INTO t1 VALUES(1, 2);
-} {}
-
-do_execsql_test 1.3 {
- SELECT * FROM t1;
-} {1 2}
-
-do_test 1.4 {
- sqlite3 db2 test.db
- execsql { SELECT * FROM t1 } db2
-} {1 2}
-
-do_test 1.5 {
- lsort [glob test.db*]
-} {test.db test.db-shm test.db-wal test.db-wal2}
-
-do_test 1.6 {
- db close
- db2 close
- sqlite3 db test.db
- execsql { SELECT * FROM t1 }
-} {1 2}
-
-do_execsql_test 1.7 {
- PRAGMA journal_size_limit = 4000;
- INSERT INTO t1 VALUES(3, 4);
- INSERT INTO t1 VALUES(5, 6);
- INSERT INTO t1 VALUES(7, 8);
- INSERT INTO t1 VALUES(9, 10);
- INSERT INTO t1 VALUES(11, 12);
- INSERT INTO t1 VALUES(13, 14);
- INSERT INTO t1 VALUES(15, 16);
- INSERT INTO t1 VALUES(17, 18);
- SELECT * FROM t1;
-} {4000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18}
-
-do_test 1.8 {
- sqlite3 db2 test.db
- execsql { SELECT * FROM t1 } db2
-} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18}
-
-do_test 1.9 {
- db close
- db2 close
- lsort [glob test.db*]
-} {test.db}
-
-#-------------------------------------------------------------------------
-reset_db
-do_execsql_test 2.0 {
- CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c);
- CREATE INDEX i1 ON t1(b, c);
- PRAGMA journal_mode = wal2;
- PRAGMA journal_size_limit = 4000;
-} {wal2 4000}
-
-proc wal_hook {DB nm nFrame} {
- $DB eval { PRAGMA wal_checkpoint }
-}
-db wal_hook [list wal_hook db]
-
-
-foreach js {4000 8000 12000} {
- foreach NROW [list 100 200 300 400 500 600 1000] {
- do_test 2.$js.$NROW.1 {
- db eval "DELETE FROM t1"
- db eval "PRAGMA journal_size_limit = $js"
- set nTotal 0
- for {set i 0} {$i < $NROW} {incr i} {
- db eval { INSERT INTO t1 VALUES($i, $i, randomblob(abs(random()%50))) }
- incr nTotal $i
- }
- set {} {}
- } {}
-
- do_test 2.$js.$NROW.2 {
- sqlite3 db2 test.db
- db2 eval {
- PRAGMA integrity_check;
- SELECT count(*), sum(b) FROM t1;
- }
- } [list ok $NROW $nTotal]
-
- db2 close
- }
-}
-
-finish_test
-