/ Check-in [7ed85e87]
Login

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

Overview
Comment:Add a test to simulate an OOM during log recovery to walfault.test.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7ed85e87dd206083310ba28afab4389885f61dac
User & Date: dan 2010-05-03 18:01:22
Context
2010-05-03
18:22
Fix a bug in the xCurrentTime() method of the os_unix.c VFS. check-in: 551df11a user: drh tags: trunk
18:01
Add a test to simulate an OOM during log recovery to walfault.test. check-in: 7ed85e87 user: dan tags: trunk
17:24
Clear global variable "seconds" before use in walthread.test. check-in: a35551a5 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/malloc_common.tcl.

    85     85           # Remove all traces of database files test.db and test2.db 
    86     86           # from the file-system. Then open (empty database) "test.db" 
    87     87           # with the handle [db].
    88     88           # 
    89     89           catch {db close} 
    90     90           catch {file delete -force test.db}
    91     91           catch {file delete -force test.db-journal}
           92  +        catch {file delete -force test.db-wal}
    92     93           catch {file delete -force test2.db}
    93     94           catch {file delete -force test2.db-journal}
           95  +        catch {file delete -force test2.db-wal}
    94     96           if {[info exists ::mallocopts(-testdb)]} {
    95     97             file copy $::mallocopts(-testdb) test.db
    96     98           }
    97     99           catch { sqlite3 db test.db }
    98    100           if {[info commands db] ne ""} {
    99    101             sqlite3_extended_result_codes db 1
   100    102           }

Changes to test/walfault.test.

    21     21   
    22     22   do_malloc_test walfault-oom-1 -sqlbody {
    23     23     PRAGMA journal_mode = WAL;
    24     24     CREATE TABLE t1(a, b);
    25     25     INSERT INTO t1 VALUES(1, 2);
    26     26     PRAGMA checkpoint;
    27     27   }
           28  +
           29  +do_malloc_test walfault-oom-2 -tclprep {
           30  +  execsql {
           31  +    PRAGMA journal_mode = WAL;
           32  +    BEGIN;
           33  +      CREATE TABLE x(y, z, UNIQUE(y, z));
           34  +      INSERT INTO x VALUES(randomblob(100), randomblob(100));
           35  +    COMMIT;
           36  +    PRAGMA wal_checkpoint;
           37  +
           38  +    INSERT INTO x SELECT randomblob(100), randomblob(100) FROM x;
           39  +    INSERT INTO x SELECT randomblob(100), randomblob(100) FROM x;
           40  +    INSERT INTO x SELECT randomblob(100), randomblob(100) FROM x;
           41  +  }
           42  +  file copy -force test.db testX.db
           43  +  file copy -force test.db-wal testX.db-wal
           44  +  db close
           45  +  file rename -force testX.db test.db
           46  +  file rename -force testX.db-wal test.db-wal
           47  +
           48  +  sqlite3 db test.db
           49  +  sqlite3_extended_result_codes db 1
           50  +  sqlite3_db_config_lookaside db 0 0 0
           51  +} -sqlbody {
           52  +  SELECT count(*) FROM x;
           53  +}
    28     54   
    29     55   
    30     56   finish_test