From 66fd2160458f8cd7fb8935b2321f02c27a54849f Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 11 Apr 2009 16:27:49 +0000 Subject: [PATCH] Fix an obscure problem with recovery from I/O errors while rolling back. (CVS 6498) FossilOrigin-Name: 24ff486125b9ad62dd92314b62299093b55fe82b --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/pager.c | 10 +++++----- test/mallocC.test | 18 +++++++++++++++++- 4 files changed, 30 insertions(+), 14 deletions(-) diff --git a/manifest b/manifest index d99067b4c1..a500f7ed54 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sa\scomments\sand\san\sassert()\sto\sthe\svirtual\stable\simplementation.\nNo\sfunctional\schanges.\s(CVS\s6497) -D 2009-04-11T16:27:20 +C Fix\san\sobscure\sproblem\swith\srecovery\sfrom\sI/O\serrors\swhile\srolling\sback.\s(CVS\s6498) +D 2009-04-11T16:27:50 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 583e87706abc3026960ed759aff6371faf84c211 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -143,7 +143,7 @@ F src/os_common.h 8c61457df58f1a4bd5f5adc3e90e01b37bf7afbc F src/os_os2.c bed77dc26e3a95ce4a204936b9a1ca6fe612fcc5 F src/os_unix.c 9ad9f45049a3c9eb0b0713b162ff0d7024ff7259 F src/os_win.c 25092e59f1e5969779c393fd75bc945c2f375513 -F src/pager.c 9775c0db675e4d9f2f0e51a04c3ec90df84c4519 +F src/pager.c e8d2bb957f01f1d030798b8ee039327bb3000d65 F src/pager.h 0c9f3520c00d8a3b8e792ca56c9a11b6b02b4b0f F src/parse.y b7e4341b21736a90b952aa6bb663ec98529b778e F src/pcache.c 395f752a13574120bd7513a400ba02a265aaa76d @@ -450,7 +450,7 @@ F test/malloc9.test 2307c6ee3703b0a21391f3ea92388b4b73f9105e F test/mallocA.test 4b650c745aab289079454f4d1c02abe5c97ab6b3 F test/mallocAll.test 2a2222a5e447be6c6579055a9a26e507e4586f4e F test/mallocB.test bc475ab850cda896142ab935bbfbc74c24e51ed6 -F test/mallocC.test 05c0bde2e41cdbdef26b9c17b8e48c935b46f611 +F test/mallocC.test 7fcfb7c6cab30dc90d0fe3f2d5e3bcda5de33761 F test/mallocD.test f78c295e8e18ea3029e65ca08278690e00c22100 F test/mallocE.test db1ed69d7eded1b080952e2a7c37f364ad241b08 F test/mallocF.test 2d5c590ebc2fc7f0dcebdf5aa8498b9aed69107e @@ -717,7 +717,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e -P 2c560e057e1da8a603efc36deea036f2392a4ab9 -R c933794e7ad3da191304723b50287bf2 +P ac5d0c0aa1de687bde972fbf0db8f04508825205 +R db20b0e5c24f9161459a802e68304a17 U drh -Z 1604cbd2809b3455fe72d9ed10306c85 +Z afe80c413e7ff05c545dbc4f3e72caef diff --git a/manifest.uuid b/manifest.uuid index e1e437eda4..470995d802 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ac5d0c0aa1de687bde972fbf0db8f04508825205 \ No newline at end of file +24ff486125b9ad62dd92314b62299093b55fe82b \ No newline at end of file diff --git a/src/pager.c b/src/pager.c index 3bc35d39ce..dfdfccd2d4 100644 --- a/src/pager.c +++ b/src/pager.c @@ -18,7 +18,7 @@ ** file simultaneously, or one process from reading the database while ** another is writing. ** -** @(#) $Id: pager.c,v 1.579 2009/04/11 09:51:56 danielk1977 Exp $ +** @(#) $Id: pager.c,v 1.580 2009/04/11 16:27:50 drh Exp $ */ #ifndef SQLITE_OMIT_DISKIO #include "sqliteInt.h" @@ -2024,11 +2024,11 @@ static int pager_playback(Pager *pPager, int isHot){ pPager->journalOff = szJ; break; }else{ - /* If we are unable to rollback, then the database is probably - ** going to end up being corrupt. It is corrupt to us, anyhow. - ** Perhaps the next process to come along can fix it.... + /* If we are unable to rollback, quit and return the error + ** code. This will cause the pager to enter the error state + ** so that no further harm will be done. Perhaps the next + ** process to come along will be able to rollback the database. */ - rc = SQLITE_CORRUPT_BKPT; goto end_playback; } } diff --git a/test/mallocC.test b/test/mallocC.test index 8bdc0d1e91..731670492d 100644 --- a/test/mallocC.test +++ b/test/mallocC.test @@ -12,7 +12,7 @@ # This file tests aspects of the malloc failure while parsing # CREATE TABLE statements in auto_vacuum mode. # -# $Id: mallocC.test,v 1.9 2008/02/18 22:24:58 drh Exp $ +# $Id: mallocC.test,v 1.10 2009/04/11 16:27:50 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -87,6 +87,22 @@ execsql { PRAGMA auto_vacuum=1; CREATE TABLE t0(a, b, c); } + +# The number of memory allocation failures is different on 64-bit +# and 32-bit systems due to larger structures on 64-bit systems +# overflowing the lookaside more often. To debug problems, it is +# sometimes helpful to reduce the size of the lookaside allocation +# blocks. But this is normally disabled. +# +if {0} { + db close + sqlite3_shutdown + sqlite3_config_lookaside 50 500 + sqlite3_initialize + autoinstall_test_functions + sqlite3 db test.db +} + do_mallocC_test 1 -sql { BEGIN; -- Allocate 32 new root pages. This will exercise the 'extract specific