/ Check-in [d7688042]
Login

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

Overview
Comment:Add tests to walcrash3.test.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d76880428013ae2c5be00d87bb3e1695af6f706f
User & Date: dan 2011-12-17 08:10:34
Context
2011-12-17
13:45
Merge in changes that cause the first sector of the WAL file to be synced when the WAL restarts. This is a fix for the power-loss corruption problem described in ticket [ff5be73dee086] check-in: 44ca4d12 user: drh tags: trunk
08:10
Add tests to walcrash3.test. check-in: d7688042 user: dan tags: trunk
01:31
Make sure the Salt-1 value in the WAL file is sequentially numbered at each checkpoint, as it says it should be in the documentation. check-in: 7b63b11b user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/permutations.test.

   106    106     fkey_malloc.test fuzz.test fuzz3.test fuzz_malloc.test in2.test loadext.test
   107    107     misc7.test mutex2.test notify2.test onefile.test pagerfault2.test 
   108    108     savepoint4.test savepoint6.test select9.test 
   109    109     speed1.test speed1p.test speed2.test speed3.test speed4.test 
   110    110     speed4p.test sqllimits1.test tkt2686.test thread001.test thread002.test
   111    111     thread003.test thread004.test thread005.test trans2.test vacuum3.test 
   112    112     incrvacuum_ioerr.test autovacuum_crash.test btree8.test shared_err.test
   113         -  vtab_err.test walslow.test walcrash.test 
   114         -  walthread.test rtree3.test indexfault.test
          113  +  vtab_err.test walslow.test walcrash.test walcrash3.test
          114  +  walthread.test rtree3.test indexfault.test 
   115    115   }]
   116    116   if {[info exists ::env(QUICKTEST_INCLUDE)]} {
   117    117     set allquicktests [concat $allquicktests $::env(QUICKTEST_INCLUDE)]
   118    118   }
   119    119   
   120    120   #############################################################################
   121    121   # Start of tests

Changes to test/walcrash3.test.

    65     65     #
    66     66     if {$::state==2} {
    67     67       sqlite3 db2 xx_test.db
    68     68       do_test 1.$i.2 { execsql { PRAGMA integrity_check  } db2 } "ok"
    69     69       do_test 1.$i.3 { execsql { SELECT count(*) FROM t1 } db2 } [expr $i-1]
    70     70       db2 close
    71     71     }
           72  +}
           73  +catch { db close }
           74  +tvfs delete
           75  +
           76  +#--------------------------------------------------------------------------
           77  +#
           78  +catch { db close }
           79  +forcedelete test.db
           80  +
           81  +do_test 2.1 {
           82  +  sqlite3 db test.db
           83  +  execsql {
           84  +    PRAGMA page_size = 512;
           85  +    PRAGMA journal_mode = WAL;
           86  +    PRAGMA wal_autocheckpoint = 128;
           87  +    CREATE TABLE t1(a PRIMARY KEY, b);
           88  +    INSERT INTO t1 VALUES(randomblob(25), randomblob(200));
           89  +  }
           90  +
           91  +  for {set i 0} {$i < 1500} {incr i} {
           92  +    execsql { INSERT INTO t1 VALUES(randomblob(25), randomblob(200)) }
           93  +  }
           94  +
           95  +  db_save
           96  +  db close
           97  +} {}
           98  +
           99  +set nInitialErr [set_test_counter errors]
          100  +for {set i 2} {$i<10000 && [set_test_counter errors]==$nInitialErr} {incr i} {
          101  +
          102  +  do_test 2.$i.1 {
          103  +    catch { db close } 
          104  +    db_restore
          105  +    crashsql -delay 2 -file test.db-wal -seed $i {
          106  +      SELECT * FROM sqlite_master;
          107  +      PRAGMA synchronous = full;
          108  +      PRAGMA wal_checkpoint;
          109  +      BEGIN;
          110  +        INSERT INTO t1 VALUES(randomblob(26), randomblob(200));
          111  +        INSERT INTO t1 VALUES(randomblob(26), randomblob(200));
          112  +        INSERT INTO t1 VALUES(randomblob(26), randomblob(200));
          113  +        INSERT INTO t1 VALUES(randomblob(26), randomblob(200));
          114  +        INSERT INTO t1 VALUES(randomblob(26), randomblob(200));
          115  +        INSERT INTO t1 VALUES(randomblob(26), randomblob(200));
          116  +        INSERT INTO t1 VALUES(randomblob(26), randomblob(200));
          117  +        INSERT INTO t1 VALUES(randomblob(26), randomblob(200));
          118  +      COMMIT;
          119  +    }
          120  +  } {1 {child process exited abnormally}}
          121  +
          122  +  do_test 2.$i.2 {
          123  +    sqlite3 db test.db
          124  +    execsql { PRAGMA integrity_check } 
          125  +  } {ok}
    72    126   }
    73    127   
    74    128   finish_test
    75    129