Fix a case where during a rollback triggered by an IO or malloc error an unjournalled region of the database could be written to (with it's original data). This was causing an assert in test_journal.c to fail. Add a test case in ioerr2.test to trigger this case. (CVS 6286)

FossilOrigin-Name: 315a6692f9a03a470871cce4f74567683546f343
This commit is contained in:
danielk1977
2009-02-12 09:11:56 +00:00
parent ce14f6245e
commit f7f33fb08a
5 changed files with 62 additions and 17 deletions
+24 -1
View File
@@ -15,7 +15,7 @@
# The tests in this file use special facilities that are only
# available in the SQLite test fixture.
#
# $Id: ioerr2.test,v 1.10 2008/09/16 14:38:04 danielk1977 Exp $
# $Id: ioerr2.test,v 1.11 2009/02/12 09:11:56 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -145,4 +145,27 @@ if {$::tcl_platform(platform) == "unix"} {
} {1 {not a writable directory}}
}
do_ioerr_test ioerr2-7 -persist 0 -sqlprep {
PRAGMA cache_size = 10;
PRAGMA auto_vacuum = 1;
CREATE TABLE ab(a, b);
CREATE TABLE de(d, e);
INSERT INTO ab VALUES(1, randstr(200,200));
INSERT INTO ab SELECT a+1, randstr(200,200) FROM ab;
INSERT INTO ab SELECT a+2, randstr(200,200) FROM ab;
INSERT INTO ab SELECT a+4, randstr(200,200) FROM ab;
INSERT INTO ab SELECT a+8, randstr(200,200) FROM ab;
INSERT INTO ab SELECT a+16, randstr(200,200) FROM ab;
INSERT INTO ab SELECT a+32, randstr(200,200) FROM ab;
INSERT INTO ab SELECT a+64, randstr(200,200) FROM ab;
INSERT INTO de SELECT * FROM ab;
} -sqlbody {
BEGIN;
UPDATE ab SET b = randstr(200,200);
UPDATE de SET e = randstr(200,200) WHERE d = (SELECT max(d) FROM de);
DELETE FROM ab;
COMMIT;
}
finish_test