OLD | NEW |
1 # 2001 September 15 | 1 # 2001 September 15 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 } | 262 } |
263 file_pages | 263 file_pages |
264 } {15} | 264 } {15} |
265 do_test autovacuum-2.4.3 { | 265 do_test autovacuum-2.4.3 { |
266 execsql { | 266 execsql { |
267 SELECT rootpage FROM sqlite_master ORDER by rootpage | 267 SELECT rootpage FROM sqlite_master ORDER by rootpage |
268 } | 268 } |
269 } {3 4 5 6 7 8 9 10} | 269 } {3 4 5 6 7 8 9 10} |
270 | 270 |
271 # Right now there are 5 free pages in the database. Consume and then free | 271 # Right now there are 5 free pages in the database. Consume and then free |
272 # a 520 pages. Then create 520 tables. This ensures that at least some of the | 272 # all 520 pages. Then create 520 tables. This ensures that at least some of the |
273 # desired root-pages reside on the second free-list trunk page, and that the | 273 # desired root-pages reside on the second free-list trunk page, and that the |
274 # trunk itself is required at some point. | 274 # trunk itself is required at some point. |
275 do_test autovacuum-2.4.4 { | 275 do_test autovacuum-2.4.4 { |
276 execsql " | 276 execsql " |
277 INSERT INTO av3 VALUES ('[make_str abcde [expr 1020*520 + 500]]'); | 277 INSERT INTO av3 VALUES ('[make_str abcde [expr 1020*520 + 500]]'); |
278 DELETE FROM av3; | 278 DELETE FROM av3; |
279 " | 279 " |
280 } {} | 280 } {} |
281 set root_page_list [list] | 281 set root_page_list [list] |
282 set pending_byte_page [expr ($::sqlite_pending_byte / 1024) + 1] | 282 set pending_byte_page [expr ($::sqlite_pending_byte / 1024) + 1] |
| 283 |
| 284 # unusable_pages |
| 285 # These are either the pending_byte page or the pointer map pages |
| 286 # |
| 287 unset -nocomplain unusable_page |
| 288 if {[sqlite3 -has-codec]} { |
| 289 array set unusable_page {205 1 408 1} |
| 290 } else { |
| 291 array set unusable_page {207 1 412 1} |
| 292 } |
| 293 set unusable_page($pending_byte_page) 1 |
| 294 |
283 for {set i 3} {$i<=532} {incr i} { | 295 for {set i 3} {$i<=532} {incr i} { |
284 # 207 and 412 are pointer-map pages. | 296 if {![info exists unusable_page($i)]} { |
285 if { $i!=207 && $i!=412 && $i != $pending_byte_page} { | |
286 lappend root_page_list $i | 297 lappend root_page_list $i |
287 } | 298 } |
288 } | 299 } |
289 if {$i >= $pending_byte_page} { | 300 if {$i >= $pending_byte_page} { |
290 lappend root_page_list $i | 301 lappend root_page_list $i |
291 } | 302 } |
292 do_test autovacuum-2.4.5 { | 303 do_test autovacuum-2.4.5 { |
293 for {set i 11} {$i<=530} {incr i} { | 304 for {set i 11} {$i<=530} {incr i} { |
294 execsql "CREATE TABLE av$i (x)" | 305 execsql "CREATE TABLE av$i (x)" |
295 } | 306 } |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 do_test autovacuum-9.4 { | 700 do_test autovacuum-9.4 { |
690 execsql { INSERT INTO t1 SELECT NULL, randstr(50,50) FROM t1 } | 701 execsql { INSERT INTO t1 SELECT NULL, randstr(50,50) FROM t1 } |
691 } {} | 702 } {} |
692 do_test autovacuum-9.5 { | 703 do_test autovacuum-9.5 { |
693 execsql { DELETE FROM t1 WHERE rowid > (SELECT max(a)/2 FROM t1) } | 704 execsql { DELETE FROM t1 WHERE rowid > (SELECT max(a)/2 FROM t1) } |
694 file size test.db | 705 file size test.db |
695 } $::sqlite_pending_byte | 706 } $::sqlite_pending_byte |
696 | 707 |
697 | 708 |
698 finish_test | 709 finish_test |
OLD | NEW |