Add test case to verify [d03d63d77e] works.

FossilOrigin-Name: bf78acb9dfacde0f08a5b3ceac13480f12a06168
This commit is contained in:
dan
2011-04-07 15:24:08 +00:00
parent 93b4fc78cf
commit 1b855bbd57
3 changed files with 83 additions and 9 deletions
+7 -7
View File
@@ -1,5 +1,5 @@
C When\ssearching\sa\slist\sof\sfreelist\strunk\spages\slooking\sfor\sa\sspecific\spage\nto\sallocate,\savoid\sunnecessary\sjournalling\sof\sthe\sunchanged\strunk\spages\stowards\nthe\sstart\sof\sthe\slist.
D 2011-04-07T14:47:01.943
C Add\stest\scase\sto\sverify\s[d03d63d77e]\sworks.
D 2011-04-07T15:24:08.318
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 7a4d9524721d40ef9ee26f93f9bd6a51dba106f2
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -494,7 +494,7 @@ F test/incrblob3.test aedbb35ea1b6450c33b98f2b6ed98e5020be8dc7
F test/incrblob_err.test c577c91d4ed9e8336cdb188b15d6ee2a6fe9604e
F test/incrblobfault.test 917c0292224c64a56ef7215fd633a3a82f805be0
F test/incrvacuum.test 453d1e490d8f5ad2c9b3a54282a0690d6ae56462
F test/incrvacuum2.test 9e22a794899c91b7d8c8e12eaacac8df249faafe
F test/incrvacuum2.test 33f8f47edf361e6f31f67c46c4963d3f6841bc07
F test/incrvacuum_ioerr.test 57d2f5777ab13fa03b87b262a4ea1bad5cfc0291
F test/index.test b5429732b3b983fa810e3ac867d7ca85dae35097
F test/index2.test ee83c6b5e3173a3d7137140d945d9a5d4fdfb9d6
@@ -927,7 +927,7 @@ F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/split-sqlite3c.tcl d9be87f1c340285a3e081eb19b4a247981ed290c
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P 532ae32ea0f5e821dac643cbc4b041c103cadfdc
R ada284aaaa309102c01ae8aa530bb601
U drh
Z 52b476a7ff4c3a8d80844592d209d819
P d03d63d77ed144ac2c02a0245c4b4b070b79c88e
R f5495057ba04c126989ad94dcb1c1777
U dan
Z 4011134d338b456807276b30795357fc
+1 -1
View File
@@ -1 +1 @@
d03d63d77ed144ac2c02a0245c4b4b070b79c88e
bf78acb9dfacde0f08a5b3ceac13480f12a06168
+75 -1
View File
@@ -23,6 +23,7 @@ ifcapable {!autovacuum || !pragma} {
return
}
set testprefix incrvacuum2
# Create a database in incremental vacuum mode that has many
# pages on the freelist.
@@ -131,6 +132,79 @@ do_test incrvacuum2-3.2 {
}
} {}
integrity_check incremental2-3.3
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