/ Check-in [e3e50bcd]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add new test file wal2big.test.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | wal2
Files: files | file ages | folders
SHA3-256: e3e50bcdab8c91e003942d84430b3e580e034141236d19dda0e8af4ecf0e085b
User & Date: dan 2018-12-12 20:39:38
Wiki:wal2
Context
2018-12-13
16:26
Add tests cases for recovery in wal2 mode. check-in: 34f56f8a user: dan tags: wal2
2018-12-12
20:39
Add new test file wal2big.test. check-in: e3e50bcd user: dan tags: wal2
19:04
Add tests to ensure that each of the 4 wal read-locks does what it is supposed to. check-in: 4d5779f3 user: dan tags: wal2
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/wal.c.

  1200   1200   
  1201   1201     if( 0==(iHash & 0x01) ){
  1202   1202       /* A frame in wal file 0 */
  1203   1203       *piRead = (iExternal <= HASHTABLE_NPAGE_ONE) ? iExternal :
  1204   1204         iExternal - (iHash/2) * HASHTABLE_NPAGE;
  1205   1205       return 0;
  1206   1206     }
  1207         -  if( iHash==0 ){
  1208         -    *piRead = iExternal;
  1209         -    return 0;
  1210         -  }else{
  1211         -    *piRead = iExternal - HASHTABLE_NPAGE_ONE - ((iHash-1)/2) * HASHTABLE_NPAGE;
  1212         -  }
  1213   1207   
  1214         -  return (iHash % 2);
         1208  +  *piRead = iExternal - HASHTABLE_NPAGE_ONE - ((iHash-1)/2) * HASHTABLE_NPAGE;
         1209  +  return 1;
  1215   1210   }
  1216   1211   
  1217   1212   /*
  1218   1213   ** Return the number of the wal-index page that contains the hash-table
  1219   1214   ** and page-number array that contain entries corresponding to WAL frame
  1220   1215   ** iFrame. The wal-index is broken up into 32KB pages. Wal-index pages 
  1221   1216   ** are numbered starting from 0.

Added test/wal2big.test.

            1  +# 2017 September 19
            2  +#
            3  +# The author disclaims copyright to this source code.  In place of
            4  +# a legal notice, here is a blessing:
            5  +#
            6  +#    May you do good and not evil.
            7  +#    May you find forgiveness for yourself and forgive others.
            8  +#    May you share freely, never taking more than you give.
            9  +#
           10  +#***********************************************************************
           11  +# This file implements regression tests for SQLite library.  The
           12  +# focus of this file is testing the operation of the library in
           13  +# "PRAGMA journal_mode=WAL2" mode.
           14  +#
           15  +
           16  +set testdir [file dirname $argv0]
           17  +source $testdir/tester.tcl
           18  +source $testdir/lock_common.tcl
           19  +source $testdir/malloc_common.tcl
           20  +source $testdir/wal_common.tcl
           21  +
           22  +set testprefix wal2big
           23  +ifcapable !wal {finish_test ; return }
           24  +
           25  +do_execsql_test 1.0 {
           26  +  CREATE TABLE t1(a, b, c);
           27  +  CREATE INDEX t1a ON t1(a);
           28  +  CREATE INDEX t1b ON t1(b);
           29  +  CREATE INDEX t1c ON t1(c);
           30  +  PRAGMA journal_mode = wal2;
           31  +  PRAGMA journal_size_limit = 10000000;
           32  +
           33  +  WITH s(i) AS (
           34  +    SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<200000
           35  +  )
           36  +  INSERT INTO t1 SELECT random(), random(), random() FROM s;
           37  +} {wal2 10000000}
           38  +
           39  +do_execsql_test 1.1 {
           40  +  WITH s(i) AS (
           41  +    SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<200000
           42  +  )
           43  +  INSERT INTO t1 SELECT random(), random(), random() FROM s;
           44  +}
           45  +
           46  +do_test 1.1 {
           47  +  list [expr [file size test.db-wal]>10000000] \
           48  +       [expr [file size test.db-wal2]>10000000]
           49  +} {1 1}
           50  +
           51  +do_test 1.2 {
           52  +  sqlite3 db2 test.db
           53  +  execsql {
           54  +    SELECT count(*) FROM t1;
           55  +    PRAGMA integrity_check;
           56  +  } db2
           57  +} {400000 ok}
           58  +
           59  +finish_test