3 set testprefix checkfreelist
10 do_execsql_test 1.2 { SELECT checkfreelist('main') } {ok}
13 SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<10000
15 INSERT INTO t1 SELECT randomblob(400), randomblob(400) FROM s;
16 DELETE FROM t1 WHERE rowid%3;
17 PRAGMA freelist_count;
20 do_execsql_test 1.4 { SELECT checkfreelist('main') } {ok}
22 WITH freelist_trunk(i, d, n) AS (
23 SELECT 1, NULL, sqlite_readint32(data, 32) FROM sqlite_dbpage WHERE pgno=1
25 SELECT n, data, sqlite_readint32(data)
26 FROM freelist_trunk, sqlite_dbpage WHERE pgno=n
28 SELECT i FROM freelist_trunk WHERE i!=1;
30 10009 9715 9343 8969 8595 8222 7847 7474 7102 6727 6354 5982 5608 5234
31 4860 4487 4112 3740 3367 2992 2619 2247 1872 1499 1125 752 377 5
34 do_execsql_test 1.6 { SELECT checkfreelist('main') } {ok}
36 proc set_int {blob idx newval} {
37 binary scan $blob I* ints
38 lset ints $idx $newval
39 binary format I* $ints
41 db func set_int set_int
43 proc get_int {blob idx} {
44 binary scan $blob I* ints
47 db func get_int get_int
52 SET data = set_int(data, 1, get_int(data, 1)-1)
54 SELECT checkfreelist('main');
56 } {{free-list count mismatch: actual=6725 header=6726}}
61 SET data = set_int(data, 5, (SELECT * FROM pragma_page_count)+1)
63 SELECT checkfreelist('main');
65 } {{leaf page 10092 is out of range (child 3 of trunk page 4860)}}
70 SET data = set_int(data, 5, 0)
72 SELECT checkfreelist('main');
74 } {{leaf page 0 is out of range (child 3 of trunk page 4860)}}
76 do_execsql_test 1.10 {
79 SET data = set_int(data, get_int(data, 1)+1, 0)
81 SELECT checkfreelist('main');
83 } {{leaf page 0 is out of range (child 247 of trunk page 5)}}
85 do_execsql_test 1.11 {
88 SET data = set_int(data, 1, 249)
90 SELECT checkfreelist('main');
92 } {{leaf count out of range (249) on trunk page 5}}