-C Add\snew\stest\sfile\swal2big.test.
-D 2018-12-12T20:39:38.782
+C Add\stests\scases\sfor\srecovery\sin\swal2\smode.
+D 2018-12-13T16:26:43.514
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F Makefile.in 68d0ba0f0b533d5bc84c78c13a6ce84ee81183a67014caa47a969e67f028fa1c
F src/vdbetrace.c 79d6dbbc479267b255a7de8080eee6e729928a0ef93ed9b0bfa5618875b48392
F src/vtab.c 70188a745dc4e57d26e942681ff4b2912b7c8249ad5de3f60f0677b4337bcfaa
F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
-F src/wal.c 7106d08dce79c9c5338c2b194139c418f21cf30dc2440145ce788893dd9b49cc
+F src/wal.c 93389c399264ca3e0728b7bc2565b4ee6a9099b78929e633ffad3bcd493e415e
F src/wal.h d2a69695c84137f76e19a247a342cb02ab0131001b6f58153d94b71195bbd84d
F src/walker.c fb94aadc9099ff9c6506d0a8b88d51266005bcaa265403f3d7caf732a562eb66
F src/where.c 3818e8a736a05d2cb194e64399af707e367fbcc5c251d785804d02eaf121288e
F test/vtab_shared.test 5253bff2355a9a3f014c15337da7e177ab0ef8ad
F test/wal.test 613efec03e517e1775d86b993a54877d2e29a477
F test/wal2.test 155b9efa999bdb38ce1cd729b9a4fcdbffd6b88be27f039bad1d2929d287d918
-F test/wal2big.test b6e78336b7aa517bf81953e118d73cd405549fb95159fab7d2b67a8eb5990ade
+F test/wal2big.test 0b4ec526f9ca4bbabc355042c38045ae2e253fb46eb327bb7693d0122bc6968b
+F test/wal2recover.test 4f14625c65cdb6132e061f85d2d441f8bb96aea4b20d4261bcf14041d8e1a735
F test/wal2rewrite.test 6ca6f631ffcf871240beab5f02608913fd075c6d0d31310b026c8383c65c9f9c
F test/wal2simple.test 96206c98bf64ab20ec00a1c0f6c709e258b98b39f2149889361f31966ce5a703
F test/wal2snapshot.test 95a919e1c73dee0e0212d10931d03cc1116f68a0ff603163e551aaa5ac7025c1
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 4d5779f31d4931edb8bb8952d8886625ead5e51f0c308e5763e519427f6609e1
-R 4985894a481d77e7477a50c3c152405c
+P e3e50bcdab8c91e003942d84430b3e580e034141236d19dda0e8af4ecf0e085b
+R e3b17b10c3f7dc5dae3bc5cc7a744091
U dan
-Z 72ed7e3951a42a191c8ff32f1f42f36f
+Z 6979d16521822ff458ef9e063c382318
/* The case where *-wal2 may follow *-wal */
if( nCkpt2<=0x0F && nCkpt2==nCkpt1+1 ){
if( sqlite3Get4byte((u8*)(&pWal->hdr.aSalt[0]))==hdr.aFrameCksum[0]
- && sqlite3Get4byte((u8*)(&pWal->hdr.aSalt[1]))==hdr.aFrameCksum[1]
- ){
+ && sqlite3Get4byte((u8*)(&pWal->hdr.aSalt[1]))==hdr.aFrameCksum[1]
+ ){
walidxSetFile(&pWal->hdr, 1);
walidxSetMxFrame(&pWal->hdr, 1, pWal->hdr.mxFrame);
walidxSetMxFrame(&pWal->hdr, 0, hdr.mxFrame);
if( pWal->hdr.nPage ){
if( isWalMode2(pWal) ){
sqlite3_log(SQLITE_NOTICE_RECOVER_WAL,
- "recovered (%d,%d) frames from WAL files %s[2] (%s mode)",
+ "recovered (%d,%d) frames from WAL files %s[2] (wal2 mode)",
walidxGetMxFrame(&pWal->hdr, 0), walidxGetMxFrame(&pWal->hdr, 1),
- pWal->zWalName, isWalMode2(pWal) ? "wal2" : "wal"
+ pWal->zWalName
);
}else{
sqlite3_log(SQLITE_NOTICE_RECOVER_WAL,
--- /dev/null
+# 2018 December 13
+#
+# 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 wal2recover
+ifcapable !wal {finish_test ; return }
+
+proc db_copy {from to} {
+ forcecopy $from $to
+ forcecopy ${from}-wal ${to}-wal
+ forcecopy ${from}-wal2 ${to}-wal2
+}
+
+do_execsql_test 1.0 {
+ CREATE TABLE t1(a, b, c);
+ CREATE INDEX t1a ON t1(a);
+ CREATE INDEX t1b ON t1(b);
+ CREATE INDEX t1c ON t1(c);
+ PRAGMA journal_mode = wal2;
+ PRAGMA journal_size_limit = 15000;
+ PRAGMA wal_autocheckpoint = 0;
+} {wal2 15000 0}
+
+do_test 1.1 {
+ for {set i 1} {$i <= 1000} {incr i} {
+ execsql { INSERT INTO t1 VALUES(random(), random(), random()) }
+ db_copy test.db test.db2
+ sqlite3 db2 test.db
+ set res [execsql {
+ SELECT count(*) FROM t1;
+ PRAGMA integrity_check;
+ } db2]
+ db2 close
+ if {$res != [list $i ok]} {
+ error "failure on iteration $i"
+ }
+ }
+ set {} {}
+} {}
+
+#--------------------------------------------------------------------------
+reset_db
+do_execsql_test 2.0 {
+ CREATE TABLE t1(x UNIQUE);
+ CREATE TABLE t2(x UNIQUE);
+ PRAGMA journal_mode = wal2;
+ PRAGMA journal_size_limit = 10000;
+ PRAGMA wal_autocheckpoint = 0;
+ BEGIN;
+ INSERT INTO t1 VALUES(randomblob(4000));
+ INSERT INTO t1 VALUES(randomblob(4000));
+ INSERT INTO t1 VALUES(randomblob(4000));
+ COMMIT;
+ BEGIN;
+ INSERT INTO t2 VALUES(randomblob(4000));
+ INSERT INTO t2 VALUES(randomblob(4000));
+ INSERT INTO t2 VALUES(randomblob(4000));
+ COMMIT;
+} {wal2 10000 0}
+do_test 2.0.1 {
+ list [file size test.db] [file size test.db-wal] [file size test.db-wal2]
+} {5120 28328 28328}
+
+# Test recovery with both wal files intact.
+#
+do_test 2.1 {
+ db_copy test.db test.db2
+ sqlite3 db2 test.db2
+ execsql {
+ SELECT count(*) FROM t1;
+ SELECT count(*) FROM t2;
+ PRAGMA integrity_check;
+ } db2
+} {3 3 ok}
+
+do_test 2.2 {
+ db2 close
+ db_copy test.db test.db2
+ hexio_write test.db2-wal 16 12345678
+ sqlite3 db2 test.db2
+ execsql {
+ SELECT count(*) FROM t1;
+ SELECT count(*) FROM t2;
+ } db2
+} {0 3}
+
+do_test 2.3 {
+ db2 close
+ db_copy test.db test.db2
+ hexio_write test.db2-wal2 16 12345678
+ sqlite3 db2 test.db2
+ execsql {
+ SELECT count(*) FROM t1;
+ SELECT count(*) FROM t2;
+ PRAGMA integrity_check;
+ } db2
+} {3 0 ok}
+
+do_test 2.4 {
+ db2 close
+ db_copy test.db test.db2
+ forcecopy test.db-wal test.db2-wal2
+ sqlite3 db2 test.db2
+ execsql {
+ SELECT count(*) FROM t1;
+ SELECT count(*) FROM t2;
+ PRAGMA integrity_check;
+ } db2
+} {3 0 ok}
+
+do_test 2.5 {
+ db2 close
+ db_copy test.db test.db2
+ forcecopy test.db-wal test.db2-wal2
+ forcecopy test.db-wal2 test.db2-wal
+ sqlite3 db2 test.db2
+ execsql {
+ SELECT count(*) FROM t1;
+ SELECT count(*) FROM t2;
+ PRAGMA integrity_check;
+ } db2
+} {3 3 ok}
+
+do_test 2.6 {
+ db2 close
+ db_copy test.db test.db2
+ forcecopy test.db-wal test.db2-wal2
+ close [open test.db-wal w]
+ sqlite3 db2 test.db2
+ execsql {
+ SELECT count(*) FROM t1;
+ SELECT count(*) FROM t2;
+ PRAGMA integrity_check;
+ } db2
+} {3 0 ok}
+
+do_test 2.7 {
+ db2 close
+ db_copy test.db test.db2
+ forcedelete test.db2-wal
+ sqlite3 db2 test.db2
+ execsql {
+ SELECT count(*) FROM t1;
+ SELECT count(*) FROM t2;
+ PRAGMA integrity_check;
+ } db2
+} {0 0 ok}
+
+finish_test
+