SQLite

Check-in [97fcd9e888]
Login

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

Overview
Comment:Add another test for [2d1a5c67df].
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 97fcd9e88891abd44037004e47862bcecfa1b0c9
User & Date: dan 2011-05-19 07:53:23.122
Context
2011-05-20
01:49
Mark an unreachable branch in the recent WAL problem as unreachable. (check-in: 3e8a29ff89 user: drh tags: trunk)
2011-05-19
07:53
Add another test for [2d1a5c67df]. (check-in: 97fcd9e888 user: dan tags: trunk)
01:21
When committing a WAL transaction, make sure at least one page is written to the WAL file so that the WAL subsystem will have a page on which to set the commit flag. Ticket [2d1a5c67dfc236]. (check-in: 67bf1c9a88 user: drh tags: trunk)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to test/tkt-2d1a5c67d.test.
13
14
15
16
17
18
19

20
21
22
23
24
25
26
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27







+







# been resolved.
#
# 
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix tkt-2d1a5c67d

ifcapable !wal {finish_test; return}

for {set ii 1} {$ii<=10} {incr ii} {
  do_test tkt-2d1a5c67d.1.$ii {
    db close
    forcedelete test.db test.db-wal
65
66
67
68
69
70
71
72





















































73
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127








+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

      INSERT INTO t1(a,b) VALUES(1,2);
      SELECT sum(length(y)) FROM t2;
      COMMIT;
      SELECT * FROM t1;
    }
  } {1000000 1 2}
}

db close
sqlite3 db test.db


do_execsql_test 3.1 {
  PRAGMA cache_size = 10;
  CREATE TABLE t3(a INTEGER PRIMARY KEY, b);
  CREATE TABLE t4(a);
}

do_execsql_test 3.2 {
  INSERT INTO t3 VALUES(NULL, randomblob(500));
  INSERT INTO t3 SELECT NULL, b||b FROM t3;     -- 2
  INSERT INTO t3 SELECT NULL, b||b FROM t3;     -- 4
  INSERT INTO t3 SELECT NULL, b||b FROM t3;     -- 8
  INSERT INTO t3 SELECT NULL, b||b FROM t3;     -- 16
  INSERT INTO t3 SELECT NULL, b||b FROM t3;     -- 32
  INSERT INTO t3 SELECT NULL, b||b FROM t3;     -- 64
  INSERT INTO t3 SELECT NULL, b||b FROM t3;     -- 128
}

do_execsql_test 3.3 {
  BEGIN;
    INSERT INTO t4 VALUES('xyz');
}

do_test 3.4 {
  set blobs [list]
  for {set i 1} {$i<100} {incr i} {
    set b [db incrblob -readonly t3 b $i]
    read $b
    lappend blobs $b
  }

  execsql COMMIT
  execsql { SELECT * FROM t4 WHERE a = 'xyz' }
} {xyz}

do_test 3.5 {
  foreach b $blobs { close $b }
  execsql { SELECT * FROM t4 WHERE a = 'xyz' }
} {xyz}

# Check that recovery works on the WAL file.
#
forcedelete test.db2-wal test.db2
do_test 3.6 {
  file copy test.db-wal test.db2-wal
  file copy test.db test.db2
  sqlite3 db2 test.db2
  execsql { SELECT * FROM t4 WHERE a = 'xyz' } db2
} {xyz}

finish_test