Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Check in test file wal2simple.test. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | wal2 |
Files: | files | file ages | folders |
SHA3-256: |
8932b2f1d7e6a26221ea3dea01000832 |
User & Date: | dan 2017-10-07 13:37:04.814 |
Context
2017-10-07
| ||
19:55 | Ignore the *-wal2 file if the *-wal file is zero bytes in size. (check-in: f7360fad51 user: dan tags: wal2) | |
13:37 | Check in test file wal2simple.test. (check-in: 8932b2f1d7 user: dan tags: wal2) | |
2017-10-06
| ||
14:25 | Merge latest trunk changes into this branch. (check-in: 7e43517861 user: dan tags: wal2) | |
Changes
Added test/wal2simple.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 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 57 58 59 60 61 62 63 64 65 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 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | # 2017 September 19 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the operation of the library in # "PRAGMA journal_mode=WAL2" mode. # set testdir [file dirname $argv0] source $testdir/tester.tcl source $testdir/lock_common.tcl source $testdir/malloc_common.tcl source $testdir/wal_common.tcl set testprefix wal2simple ifcapable !wal {finish_test ; return } #------------------------------------------------------------------------- # The following tests verify that a client can switch in and out of wal # and wal2 mode. But that it is not possible to change directly from wal # to wal2, or from wal2 to wal mode. # do_execsql_test 1.1.0 { PRAGMA journal_mode = wal2 } {wal2} execsql { SELECT * FROM sqlite_master} do_execsql_test 1.x { PRAGMA journal_mode; PRAGMA main.journal_mode; } {wal2 wal2} db close do_test 1.1.1 { file size test.db } {1024} do_test 1.1.2 { hexio_read test.db 18 2 } 0303 sqlite3 db test.db do_execsql_test 1.2.0 { SELECT * FROM sqlite_master; PRAGMA journal_mode = delete; } {delete} db close do_test 1.2.1 { file size test.db } {1024} do_test 1.2.2 { hexio_read test.db 18 2 } 0101 sqlite3 db test.db do_execsql_test 1.3.0 { SELECT * FROM sqlite_master; PRAGMA journal_mode = wal; } {wal} db close do_test 1.3.1 { file size test.db } {1024} do_test 1.3.2 { hexio_read test.db 18 2 } 0202 sqlite3 db test.db do_catchsql_test 1.4.0 { PRAGMA journal_mode = wal2; } {1 {cannot change from wal to wal2 mode}} do_execsql_test 1.4.1 { PRAGMA journal_mode = wal; PRAGMA journal_mode = delete; PRAGMA journal_mode = wal2; PRAGMA journal_mode = wal2; } {wal delete wal2 wal2} do_catchsql_test 1.4.2 { PRAGMA journal_mode = wal; } {1 {cannot change from wal2 to wal mode}} db close do_test 1.4.3 { hexio_read test.db 18 2 } 0303 #------------------------------------------------------------------------- # Test that recovery in wal2 mode works. # forcedelete test.db test.db-wal test.db-wal2 reset_db do_execsql_test 2.0 { CREATE TABLE t1(a INTEGER PRIMARY KEY, b); PRAGMA journal_mode = wal2; PRAGMA journal_size_limit = 5000; } {wal2 5000} proc wal_hook {DB nm nFrame} { $DB eval { PRAGMA wal_checkpoint } } db wal_hook {wal_hook db} for {set i 1} {$i <= 200} {incr i} { execsql { INSERT INTO t1 VALUES(NULL, randomblob(100)) } set res [db eval { SELECT sum(a), md5sum(b) FROM t1 }] do_test 2.1.$i { foreach f [glob -nocomplain test.db2*] { forcedelete $f } forcecopy test.db test.db2 forcecopy test.db-wal test.db2-wal forcecopy test.db-wal2 test.db2-wal2 sqlite3 db2 test.db2 db2 eval { SELECT sum(a), md5sum(b) FROM t1 } } $res db2 close } #------------------------------------------------------------------------- reset_db do_execsql_test 3.0 { CREATE TABLE t1(x BLOB, y INTEGER PRIMARY KEY); CREATE INDEX i1 ON t1(x); PRAGMA cache_size = 5; PRAGMA journal_mode = wal2; } {wal2} do_test 3.1 { execsql BEGIN for {set i 1} {$i < 1000} {incr i} { execsql { INSERT INTO t1 VALUES(randomblob(800), $i) } } execsql COMMIT } {} do_execsql_test 3.2 { PRAGMA integrity_check; } {ok} #------------------------------------------------------------------------- catch { db close } foreach f [glob -nocomplain test.db*] { forcedelete $f } reset_db do_execsql_test 4.0 { CREATE TABLE t1(x, y); PRAGMA journal_mode = wal2; } {wal2} do_execsql_test 4.1 { SELECT * FROM t1; } {} do_execsql_test 4.2 { INSERT INTO t1 VALUES(1, 2); } {} do_execsql_test 4.3 { SELECT * FROM t1; } {1 2} do_test 4.4 { sqlite3 db2 test.db execsql { SELECT * FROM t1 } db2 } {1 2} do_test 4.5 { lsort [glob test.db*] } {test.db test.db-shm test.db-wal test.db-wal2} do_test 4.6 { db close db2 close sqlite3 db test.db execsql { SELECT * FROM t1 } } {1 2} do_execsql_test 4.7 { PRAGMA journal_size_limit = 4000; INSERT INTO t1 VALUES(3, 4); INSERT INTO t1 VALUES(5, 6); INSERT INTO t1 VALUES(7, 8); INSERT INTO t1 VALUES(9, 10); INSERT INTO t1 VALUES(11, 12); INSERT INTO t1 VALUES(13, 14); INSERT INTO t1 VALUES(15, 16); INSERT INTO t1 VALUES(17, 18); SELECT * FROM t1; } {4000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18} do_test 4.8 { sqlite3 db2 test.db execsql { SELECT * FROM t1 } db2 } {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18} do_test 4.9 { db close db2 close lsort [glob test.db*] } {test.db} #------------------------------------------------------------------------- reset_db do_execsql_test 5.0 { CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c); CREATE INDEX i1 ON t1(b, c); PRAGMA journal_mode = wal2; PRAGMA journal_size_limit = 4000; } {wal2 4000} proc wal_hook {DB nm nFrame} { $DB eval { PRAGMA wal_checkpoint } } db wal_hook [list wal_hook db] foreach js {4000 8000 12000} { foreach NROW [list 100 200 300 400 500 600 1000] { do_test 5.$js.$NROW.1 { db eval "DELETE FROM t1" db eval "PRAGMA journal_size_limit = $js" set nTotal 0 for {set i 0} {$i < $NROW} {incr i} { db eval { INSERT INTO t1 VALUES($i, $i, randomblob(abs(random()%50))) } incr nTotal $i } set {} {} } {} do_test 5.$js.$NROW.2 { sqlite3 db2 test.db db2 eval { PRAGMA integrity_check; SELECT count(*), sum(b) FROM t1; } } [list ok $NROW $nTotal] db2 close } } finish_test |
Deleted test/waltwo2.test.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |