/ 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 Unified Diffs Ignore Whitespace Patch

Changes to test/malloc_common.tcl.

85
86
87
88
89
90
91

92
93

94
95
96
97
98
99
100
        # Remove all traces of database files test.db and test2.db 
        # from the file-system. Then open (empty database) "test.db" 
        # with the handle [db].
        # 
        catch {db close} 
        catch {file delete -force test.db}
        catch {file delete -force test.db-journal}

        catch {file delete -force test2.db}
        catch {file delete -force test2.db-journal}

        if {[info exists ::mallocopts(-testdb)]} {
          file copy $::mallocopts(-testdb) test.db
        }
        catch { sqlite3 db test.db }
        if {[info commands db] ne ""} {
          sqlite3_extended_result_codes db 1
        }







>


>







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

Changes to test/walfault.test.

21
22
23
24
25
26
27
28








29


















30

do_malloc_test walfault-oom-1 -sqlbody {
  PRAGMA journal_mode = WAL;
  CREATE TABLE t1(a, b);
  INSERT INTO t1 VALUES(1, 2);
  PRAGMA checkpoint;
}




























finish_test








>
>
>
>
>
>
>
>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

do_malloc_test walfault-oom-1 -sqlbody {
  PRAGMA journal_mode = WAL;
  CREATE TABLE t1(a, b);
  INSERT INTO t1 VALUES(1, 2);
  PRAGMA checkpoint;
}

do_malloc_test walfault-oom-2 -tclprep {
  execsql {
    PRAGMA journal_mode = WAL;
    BEGIN;
      CREATE TABLE x(y, z, UNIQUE(y, z));
      INSERT INTO x VALUES(randomblob(100), randomblob(100));
    COMMIT;
    PRAGMA wal_checkpoint;

    INSERT INTO x SELECT randomblob(100), randomblob(100) FROM x;
    INSERT INTO x SELECT randomblob(100), randomblob(100) FROM x;
    INSERT INTO x SELECT randomblob(100), randomblob(100) FROM x;
  }
  file copy -force test.db testX.db
  file copy -force test.db-wal testX.db-wal
  db close
  file rename -force testX.db test.db
  file rename -force testX.db-wal test.db-wal

  sqlite3 db test.db
  sqlite3_extended_result_codes db 1
  sqlite3_db_config_lookaside db 0 0 0
} -sqlbody {
  SELECT count(*) FROM x;
}


finish_test