Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add test case to verify [d03d63d77e] works. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
bf78acb9dfacde0f08a5b3ceac13480f |
User & Date: | dan 2011-04-07 15:24:08.318 |
Context
2011-04-07
| ||
19:56 | Change two new internal functions in where.c from global to file scope. (check-in: 5bbfa17d4d user: drh tags: trunk) | |
15:24 | Add test case to verify [d03d63d77e] works. (check-in: bf78acb9df user: dan tags: trunk) | |
14:47 | When searching a list of freelist trunk pages looking for a specific page to allocate, avoid unnecessary journalling of the unchanged trunk pages towards the start of the list. (check-in: d03d63d77e user: drh tags: trunk) | |
Changes
Changes to test/incrvacuum2.test.
︙ | ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 | # If this build of the library does not support auto-vacuum, omit this # whole file. ifcapable {!autovacuum || !pragma} { finish_test return } # Create a database in incremental vacuum mode that has many # pages on the freelist. # do_test incrvacuum2-1.1 { execsql { PRAGMA page_size=1024; | > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | # If this build of the library does not support auto-vacuum, omit this # whole file. ifcapable {!autovacuum || !pragma} { finish_test return } set testprefix incrvacuum2 # Create a database in incremental vacuum mode that has many # pages on the freelist. # do_test incrvacuum2-1.1 { execsql { PRAGMA page_size=1024; |
︙ | ︙ | |||
127 128 129 130 131 132 133 | BEGIN; DELETE FROM abc; PRAGMA incremental_vacuum; COMMIT; } } {} | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | BEGIN; DELETE FROM abc; PRAGMA incremental_vacuum; COMMIT; } } {} integrity_check incrvacuum2-3.3 ifcapable wal { # At one point, when a specific page was being extracted from the b-tree # free-list (e.g. during an incremental-vacuum), all trunk pages that # occurred before the specific page in the free-list trunk were being # written to the journal or wal file. This is not necessary. Only the # extracted page and the page that contains the pointer to it need to # be journalled. # # This problem was fixed by [d03d63d77e] (just before 3.7.6 release). # # This test case builds a database containing many free pages. Then runs # "PRAGMA incremental_vacuum(1)" until the db contains zero free pages. # Each "PRAGMA incremental_vacuum(1)" should modify at most 4 pages. The # worst case is when a trunk page is removed from the end of the db file. # In this case pages written are: # # 1. The previous trunk page (that contains a pointer to the recycled # trunk page), and # 2. The leaf page transformed into a trunk page to replace the recycled # page, and # 3. The trunk page that contained a pointer to the leaf page used # in (2), and # 4. Page 1. Page 1 is always updated, even in WAL mode, since it contains # the "number of free-list pages" field. # db close forcedelete test.db sqlite3 db test.db do_execsql_test 4.1 { PRAGMA page_size = 512; PRAGMA auto_vacuum = 2; CREATE TABLE t1(x); INSERT INTO t1 VALUES(randomblob(400)); INSERT INTO t1 SELECT * FROM t1; -- 2 INSERT INTO t1 SELECT * FROM t1; -- 4 INSERT INTO t1 SELECT * FROM t1; -- 8 INSERT INTO t1 SELECT * FROM t1; -- 16 INSERT INTO t1 SELECT * FROM t1; -- 32 INSERT INTO t1 SELECT * FROM t1; -- 128 INSERT INTO t1 SELECT * FROM t1; -- 256 INSERT INTO t1 SELECT * FROM t1; -- 512 INSERT INTO t1 SELECT * FROM t1; -- 1024 INSERT INTO t1 SELECT * FROM t1; -- 2048 INSERT INTO t1 SELECT * FROM t1; -- 4096 INSERT INTO t1 SELECT * FROM t1; -- 8192 DELETE FROM t1 WHERE oid>512; DELETE FROM t1; } do_test 4.2 { execsql { PRAGMA journal_mode = WAL; PRAGMA incremental_vacuum(1); PRAGMA wal_checkpoint; } file size test.db-wal } {1640} do_test 4.3 { db close sqlite3 db test.db set maxsz 0 while {[file size test.db] > [expr 512*3]} { execsql { PRAGMA wal_checkpoint } execsql { PRAGMA incremental_vacuum(1) } set newsz [file size test.db-wal] if {$newsz>$maxsz} {set maxsz $newsz} } set maxsz } {2176} } finish_test |