/ Check-in [a2b9374f]
Login

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

Overview
Comment:Fix an error in the walfault.test script introduced by the previous check-in.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a2b9374fc6f0aba2d465d432e1124bd957aab548
User & Date: drh 2010-06-14 18:06:21
Context
2010-06-15
11:21
Updates to comments and testcase() macros in wal.c. check-in: 4d90cc0b user: drh tags: trunk
2010-06-14
18:06
Fix an error in the walfault.test script introduced by the previous check-in. check-in: a2b9374f user: drh tags: trunk
18:01
Move the xShmMap method to in between xShmLock and xShmBarrier, since it seems to fit in there logically. check-in: 58dfd83d user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/walfault.test.

149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
...
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
...
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
...
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
...
440
441
442
443
444
445
446
447
    PRAGMA journal_mode = WAL;
  }
  faultsim_save_and_close
} {}
do_faultsim_test walfault-5 -faults shmerr* -prep {
  faultsim_restore_and_reopen
  execsql { PRAGMA wal_autocheckpoint = 0 }
  shmfault filter xShmPage
} -body {
  execsql {
    CREATE TABLE t1(x);
    BEGIN;
      INSERT INTO t1 VALUES(randomblob(400));           /* 1 */
      INSERT INTO t1 SELECT randomblob(400) FROM t1;    /* 2 */
      INSERT INTO t1 SELECT randomblob(400) FROM t1;    /* 4 */
................................................................................
      INSERT INTO t1 SELECT randomblob(400) FROM t1;    /* 16384 */
    COMMIT;
  }
  faultsim_save_and_close
} {}
do_faultsim_test walfault-6 -faults shmerr* -prep {
  faultsim_restore_and_reopen
  shmfault filter xShmPage
} -body {
  execsql { SELECT count(*) FROM t1 }
} -test {
  faultsim_test_result {0 16384}
  faultsim_integrity_check
  set n [db one {SELECT count(*) FROM t1}]
  if {$n != 16384 && $n != 0} { error "Incorrect number of rows: $n" }
................................................................................
#--------------------------------------------------------------------------
# Test fault injection while checkpointing a large WAL file, if the 
# checkpoint is the first operation run after opening the database.
# This means that some of the required wal-index pages are mapped as part of
# the checkpoint process, which means there are a few more opportunities
# for IO errors.
#
# To speed this up, IO errors are only simulated within xShmPage() calls.
#
do_test walfault-11-pre-1 {
  sqlite3 db test.db
  execsql {
    PRAGMA journal_mode = WAL;
    PRAGMA wal_autocheckpoint = 0;
    BEGIN;
................................................................................
    COMMIT;
  }
  faultsim_save_and_close
} {}
do_faultsim_test walfault-11 -faults shmerr* -prep {
  catch { db2 close }
  faultsim_restore_and_reopen
  shmfault filter xShmPage
} -body {
  db eval { SELECT count(*) FROM abc }
  sqlite3 db2 test.db -vfs shmfault
  db2 eval { PRAGMA wal_checkpoint }
} -test {
  faultsim_test_result {0 {}}
}
................................................................................
} -test {
  db close
  faultsim_test_result {0 {}}
}


finish_test








|







 







|







 







|







 







|







 







<
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
...
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
...
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
...
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
...
440
441
442
443
444
445
446

    PRAGMA journal_mode = WAL;
  }
  faultsim_save_and_close
} {}
do_faultsim_test walfault-5 -faults shmerr* -prep {
  faultsim_restore_and_reopen
  execsql { PRAGMA wal_autocheckpoint = 0 }
  shmfault filter xShmMap
} -body {
  execsql {
    CREATE TABLE t1(x);
    BEGIN;
      INSERT INTO t1 VALUES(randomblob(400));           /* 1 */
      INSERT INTO t1 SELECT randomblob(400) FROM t1;    /* 2 */
      INSERT INTO t1 SELECT randomblob(400) FROM t1;    /* 4 */
................................................................................
      INSERT INTO t1 SELECT randomblob(400) FROM t1;    /* 16384 */
    COMMIT;
  }
  faultsim_save_and_close
} {}
do_faultsim_test walfault-6 -faults shmerr* -prep {
  faultsim_restore_and_reopen
  shmfault filter xShmMap
} -body {
  execsql { SELECT count(*) FROM t1 }
} -test {
  faultsim_test_result {0 16384}
  faultsim_integrity_check
  set n [db one {SELECT count(*) FROM t1}]
  if {$n != 16384 && $n != 0} { error "Incorrect number of rows: $n" }
................................................................................
#--------------------------------------------------------------------------
# Test fault injection while checkpointing a large WAL file, if the 
# checkpoint is the first operation run after opening the database.
# This means that some of the required wal-index pages are mapped as part of
# the checkpoint process, which means there are a few more opportunities
# for IO errors.
#
# To speed this up, IO errors are only simulated within xShmMap() calls.
#
do_test walfault-11-pre-1 {
  sqlite3 db test.db
  execsql {
    PRAGMA journal_mode = WAL;
    PRAGMA wal_autocheckpoint = 0;
    BEGIN;
................................................................................
    COMMIT;
  }
  faultsim_save_and_close
} {}
do_faultsim_test walfault-11 -faults shmerr* -prep {
  catch { db2 close }
  faultsim_restore_and_reopen
  shmfault filter xShmMap
} -body {
  db eval { SELECT count(*) FROM abc }
  sqlite3 db2 test.db -vfs shmfault
  db2 eval { PRAGMA wal_checkpoint }
} -test {
  faultsim_test_result {0 {}}
}
................................................................................
} -test {
  db close
  faultsim_test_result {0 {}}
}


finish_test