From: dan Date: Wed, 12 Dec 2018 20:39:38 +0000 (+0000) Subject: Add new test file wal2big.test. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eeb778d506e429549090fd78b75282b579908e8a;p=thirdparty%2Fsqlite.git Add new test file wal2big.test. FossilOrigin-Name: e3e50bcdab8c91e003942d84430b3e580e034141236d19dda0e8af4ecf0e085b --- diff --git a/manifest b/manifest index 4cb34c27b4..8249da62fe 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\stests\sto\sensure\sthat\seach\sof\sthe\s4\swal\sread-locks\sdoes\swhat\sit\sis\ssupposed\sto. -D 2018-12-12T19:04:19.425 +C Add\snew\stest\sfile\swal2big.test. +D 2018-12-12T20:39:38.782 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in 68d0ba0f0b533d5bc84c78c13a6ce84ee81183a67014caa47a969e67f028fa1c @@ -590,7 +590,7 @@ F src/vdbesort.c 90aad5a92608f2dd771c96749beabdb562c9d881131a860a7a5bccf66dc3be7 F src/vdbetrace.c 79d6dbbc479267b255a7de8080eee6e729928a0ef93ed9b0bfa5618875b48392 F src/vtab.c 70188a745dc4e57d26e942681ff4b2912b7c8249ad5de3f60f0677b4337bcfaa F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9 -F src/wal.c 22850fcd2efa9b13e237f6097f931fe7dbd9e50f401a659288d70ae3951396b8 +F src/wal.c 7106d08dce79c9c5338c2b194139c418f21cf30dc2440145ce788893dd9b49cc F src/wal.h d2a69695c84137f76e19a247a342cb02ab0131001b6f58153d94b71195bbd84d F src/walker.c fb94aadc9099ff9c6506d0a8b88d51266005bcaa265403f3d7caf732a562eb66 F src/where.c 3818e8a736a05d2cb194e64399af707e367fbcc5c251d785804d02eaf121288e @@ -1596,6 +1596,7 @@ F test/vtab_err.test dcc8b7b9cb67522b3fe7a272c73856829dae4ab7fdb30399aea1b6981bd F test/vtab_shared.test 5253bff2355a9a3f014c15337da7e177ab0ef8ad F test/wal.test 613efec03e517e1775d86b993a54877d2e29a477 F test/wal2.test 155b9efa999bdb38ce1cd729b9a4fcdbffd6b88be27f039bad1d2929d287d918 +F test/wal2big.test b6e78336b7aa517bf81953e118d73cd405549fb95159fab7d2b67a8eb5990ade F test/wal2rewrite.test 6ca6f631ffcf871240beab5f02608913fd075c6d0d31310b026c8383c65c9f9c F test/wal2simple.test 96206c98bf64ab20ec00a1c0f6c709e258b98b39f2149889361f31966ce5a703 F test/wal2snapshot.test 95a919e1c73dee0e0212d10931d03cc1116f68a0ff603163e551aaa5ac7025c1 @@ -1787,7 +1788,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 18b2c23ac53d985ccc5798ea2d92fb75644b857c373fb490e0d04d5d0194a3d5 -R 234c1705f2bf2a9abb44249d0ee7aea0 +P 4d5779f31d4931edb8bb8952d8886625ead5e51f0c308e5763e519427f6609e1 +R 4985894a481d77e7477a50c3c152405c U dan -Z d3854fa2ddea650fc625b1a32d28af78 +Z 72ed7e3951a42a191c8ff32f1f42f36f diff --git a/manifest.uuid b/manifest.uuid index 60eb3eb58e..65c0861b34 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4d5779f31d4931edb8bb8952d8886625ead5e51f0c308e5763e519427f6609e1 \ No newline at end of file +e3e50bcdab8c91e003942d84430b3e580e034141236d19dda0e8af4ecf0e085b \ No newline at end of file diff --git a/src/wal.c b/src/wal.c index 634de7ec6f..4cc37d0700 100644 --- a/src/wal.c +++ b/src/wal.c @@ -1204,14 +1204,9 @@ static int walExternalDecode(u32 iExternal, u32 *piRead){ iExternal - (iHash/2) * HASHTABLE_NPAGE; return 0; } - if( iHash==0 ){ - *piRead = iExternal; - return 0; - }else{ - *piRead = iExternal - HASHTABLE_NPAGE_ONE - ((iHash-1)/2) * HASHTABLE_NPAGE; - } - return (iHash % 2); + *piRead = iExternal - HASHTABLE_NPAGE_ONE - ((iHash-1)/2) * HASHTABLE_NPAGE; + return 1; } /* diff --git a/test/wal2big.test b/test/wal2big.test new file mode 100644 index 0000000000..2758108479 --- /dev/null +++ b/test/wal2big.test @@ -0,0 +1,59 @@ +# 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 wal2big +ifcapable !wal {finish_test ; return } + +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 = 10000000; + + WITH s(i) AS ( + SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<200000 + ) + INSERT INTO t1 SELECT random(), random(), random() FROM s; +} {wal2 10000000} + +do_execsql_test 1.1 { + WITH s(i) AS ( + SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<200000 + ) + INSERT INTO t1 SELECT random(), random(), random() FROM s; +} + +do_test 1.1 { + list [expr [file size test.db-wal]>10000000] \ + [expr [file size test.db-wal2]>10000000] +} {1 1} + +do_test 1.2 { + sqlite3 db2 test.db + execsql { + SELECT count(*) FROM t1; + PRAGMA integrity_check; + } db2 +} {400000 ok} + +finish_test