-C Check\sin\stest\sfile\swal2simple.test.
-D 2017-10-07T13:37:04.814
+C Ignore\sthe\s*-wal2\sfile\sif\sthe\s*-wal\sfile\sis\szero\sbytes\sin\ssize.
+D 2017-10-07T19:55:37.322
F Makefile.in 4bc36d913c2e3e2d326d588d72f618ac9788b2fd4b7efda61102611a6495c3ff
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 6033b51b6aea702ea059f6ab2d47b1d3cef648695f787247dd4fb395fe60673f
F src/vdbetrace.c 48e11ebe040c6b41d146abed2602e3d00d621d7ebe4eb29b0a0f1617fd3c2f6c
F src/vtab.c 0e4885495172e1bdf54b12cce23b395ac74ef5729031f15e1bc1e3e6b360ed1a
F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
-F src/wal.c 287feccc5c6e886a5d747f5555382280e85a24904d0378940ef3869eb4273571
+F src/wal.c 11314f64edbb7613e80290830a7379ff083b511bd1ee97846518c3102ebf5c4f
F src/wal.h b6063e6be1b03389372f3f32240e99b8ab92c32cdd05aa0e31b30a21e4e41654
F src/walker.c 3ccfa8637f95355bff61144e01a615b8ef26f79c312880848da73f03367da1e6
F src/where.c 049522adcf5426f1a8c3ed07be15e1ffa3266afd34e8e7bee64b63e2fbfad0b5
F test/wal.test 613efec03e517e1775d86b993a54877d2e29a477
F test/wal2.test 6ac39b94a284ebac6efb6be93b0cdfe73ee6083f129555e3144d8a615e9900ef
F test/wal2rewrite.test 6ca6f631ffcf871240beab5f02608913fd075c6d0d31310b026c8383c65c9f9c
-F test/wal2simple.test 7ea5b2bfedace701a6415d27ecac7bcd852381435b6f3d71bb90eda0db11b2b9
+F test/wal2simple.test 8719413446ca97ca88507c5b79f139b631faa5b4e177b7424008b26fc153da30
F test/wal3.test 2a93004bc0fb2b5c29888964024695bade278ab2
F test/wal4.test 4744e155cd6299c6bd99d3eab1c82f77db9cdb3c
F test/wal5.test 9c11da7aeccd83a46d79a556ad11a18d3cb15aa9
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 7e43517861d4ecfa86766a16a2c721377b75da78771d5ba18870dcb9626a8dce
-R efd9b7af2079a6949a0d309021efe433
+P 8932b2f1d7e6a26221ea3dea01000832b2d1eb17ac0b70ef6028f9286ae450a3
+R c46e3ca31dc60584535891a8280b1e6f
U dan
-Z 3fd52f62c898d986eaf1742529c99b05
+Z fe4e7b40b37235ec7703f9add7af6779
-8932b2f1d7e6a26221ea3dea01000832b2d1eb17ac0b70ef6028f9286ae450a3
\ No newline at end of file
+f7360fad51f224f347bb7d263eb89056b27461c278309e00e575a0e8898c9f40
\ No newline at end of file
return rc;
}
+static int walTruncateWal2(Wal *pWal){
+ int bIs;
+ int rc;
+ assert( !isOpen(pWal->apWalFd[1]) );
+ rc = sqlite3OsAccess(pWal->pVfs, pWal->zWalName2, SQLITE_ACCESS_EXISTS, &bIs);
+ if( rc==SQLITE_OK && bIs ){
+ rc = walOpenWal2(pWal);
+ if( rc==SQLITE_OK ){
+ rc = sqlite3OsTruncate(pWal->apWalFd[1], 0);
+ sqlite3OsClose(pWal->apWalFd[1]);
+ }
+ }
+ return rc;
+}
+
/*
** Recover the wal-index by reading the write-ahead log file.
**
|| pWal->hdr.iVersion==WAL_VERSION1
|| pWal->hdr.iVersion==WAL_VERSION2
);
+ if( rc==SQLITE_OK && bZero ){
+ rc = walTruncateWal2(pWal);
+ }
if( rc==SQLITE_OK && pWal->hdr.iVersion!=WAL_VERSION1 ){
int bOpen = 1;
sqlite3_vfs *pVfs = pWal->pVfs;
pWal->hdr = hdr;
}else{
walidxSetFile(&pWal->hdr, 1);
+ walidxSetMxFrame(&pWal->hdr, 1, pWal->hdr.mxFrame);
+ walidxSetMxFrame(&pWal->hdr, 0, 0);
}
pWal->hdr.iVersion = WAL_VERSION2;
}else{
}
+#-------------------------------------------------------------------------
+reset_db
+do_execsql_test 6.0 {
+ CREATE TABLE tx(x);
+ PRAGMA journal_mode = wal2;
+ PRAGMA journal_size_limit = 3500;
+} {wal2 3500}
+
+do_test 6.1 {
+ for {set i 0} {$i < 10} {incr i} {
+ execsql "CREATE TABLE t$i (x);"
+ }
+} {}
+
+puts "[file size test.db-wal] [file size test.db-wal2]"
+
+do_test 6.2.1 {
+ foreach f [glob -nocomplain test.db2*] { forcedelete $f }
+ forcecopy test.db-wal2 test.db2-wal2
+ sqlite3 db2 test.db2
+ db2 eval { SELECT * FROM sqlite_master }
+} {}
+do_test 6.2.2 {
+ db2 eval {
+ PRAGMA journal_mode = wal2;
+ SELECT * FROM sqlite_master;
+ }
+} {wal2}
+
+do_test 6.3.1 {
+ db2 close
+ foreach f [glob -nocomplain test.db2*] { forcedelete $f }
+ forcecopy test.db-wal2 test.db2-wal2
+ forcecopy test.db test.db2
+ sqlite3 db2 test.db2
+ db2 eval { SELECT * FROM sqlite_master }
+} {table tx tx 2 {CREATE TABLE tx(x)}}
+do_test 6.3.2 {
+ db2 eval {
+ PRAGMA journal_mode = wal2;
+ SELECT * FROM sqlite_master;
+ }
+} {wal2 table tx tx 2 {CREATE TABLE tx(x)}}
+do_test 6.4.1 {
+ db2 close
+ foreach f [glob -nocomplain test.db2*] { forcedelete $f }
+ forcecopy test.db-wal2 test.db2-wal2
+ forcecopy test.db-wal test.db2-wal
+ sqlite3 db2 test.db2
+ db2 eval { SELECT * FROM sqlite_master }
+} {}
+do_test 6.4.2 {
+ db2 eval {
+ PRAGMA journal_mode = wal2;
+ SELECT * FROM sqlite_master;
+ }
+} {wal2}
+db2 close
finish_test