mirror of
https://github.com/sqlite/sqlite.git
synced 2025-06-26 20:21:09 +03:00
If a pager is already in the error-state when CommitPhaseOne() is called, exit early. (CVS 5134)
FossilOrigin-Name: 443cf1056c73ae89d0efcc7a462455c078b3a4a8
This commit is contained in:
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
||||
C Fix\sa\stest\sscript\sbug\s-\snot\sall\sdatabase\shandles\swere\sbeing\sclosed\sby\sioerr5.test.\s(CVS\s5133)
|
||||
D 2008-05-15T09:07:56
|
||||
C If\sa\spager\sis\salready\sin\sthe\serror-state\swhen\sCommitPhaseOne()\sis\scalled,\sexit\searly.\s(CVS\s5134)
|
||||
D 2008-05-15T11:08:08
|
||||
F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
|
||||
F Makefile.in 79aeba12300a54903f1b1257c1e7c190234045dd
|
||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||
@ -121,7 +121,7 @@ F src/os_common.h e8b748b2f2ecc8a498e50bfe5d8721f189c19d2a
|
||||
F src/os_os2.c 0c3a5802bc4fdb7cb5f66771552b081c4e48a216
|
||||
F src/os_unix.c a810e2aefdaddacf479407f76f8f4ca381d231b2
|
||||
F src/os_win.c 3a60bddd07ea6f8adb2314dd5996ac97b988f403
|
||||
F src/pager.c eae53a807a85e6f68454e42a1a81754abe4216e3
|
||||
F src/pager.c 43f5f67ff211ed0f40ccd9a96c079e811a9ac601
|
||||
F src/pager.h 4f051fd856de6fd3c19aef5f82eace54122b9173
|
||||
F src/parse.y fc4bd35c6088901f7c8daead26c6fb11c87d22e7
|
||||
F src/pragma.c 2e4bb2e76e48a32750529fdc4bfe86ac5f54e01b
|
||||
@ -345,7 +345,7 @@ F test/ioerr.test 32cff40562447bda194ba67ad601170edbaed49b
|
||||
F test/ioerr2.test b9c9a0491a812707762a7c002876553be54d9969
|
||||
F test/ioerr3.test d3cec5e1a11ad6d27527d0d38573fbff14c71bdd
|
||||
F test/ioerr4.test fc6eddfec2efc2f1ed217b9eae4c1c1d3516ce86
|
||||
F test/ioerr5.test 3efdada539683af68f7630b83843b53ed45818f1
|
||||
F test/ioerr5.test f44e30b4780b879bcceb2601aabae40d8a0a0b56
|
||||
F test/join.test af0443185378b64878750aa1cf4b83c216f246b4
|
||||
F test/join2.test f2171c265e57ee298a27e57e7051d22962f9f324
|
||||
F test/join3.test 6f0c774ff1ba0489e6c88a3e77b9d3528fb4fda0
|
||||
@ -635,7 +635,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
|
||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
||||
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
|
||||
P 10ea8287d090ae610416b4754c0838f13b51fd78
|
||||
R d0ced0e9fffeaaa2b43426ebd729f2cc
|
||||
P 47652e7b169626e5f3d95f29e867a2e8f68c5025
|
||||
R d8f7609758174cb331cdc46a0cb952a9
|
||||
U danielk1977
|
||||
Z 0bd221f8c209aa798908237921045fbf
|
||||
Z 7ea980f7a54707b1517ab40c9892ab63
|
||||
|
@ -1 +1 @@
|
||||
47652e7b169626e5f3d95f29e867a2e8f68c5025
|
||||
443cf1056c73ae89d0efcc7a462455c078b3a4a8
|
@ -18,7 +18,7 @@
|
||||
** file simultaneously, or one process from reading the database while
|
||||
** another is writing.
|
||||
**
|
||||
** @(#) $Id: pager.c,v 1.447 2008/05/15 08:34:54 danielk1977 Exp $
|
||||
** @(#) $Id: pager.c,v 1.448 2008/05/15 11:08:08 danielk1977 Exp $
|
||||
*/
|
||||
#ifndef SQLITE_OMIT_DISKIO
|
||||
#include "sqliteInt.h"
|
||||
@ -4614,6 +4614,10 @@ int sqlite3PagerCommitPhaseOne(
|
||||
){
|
||||
int rc = SQLITE_OK;
|
||||
|
||||
if( pPager->errCode ){
|
||||
return pPager->errCode;
|
||||
}
|
||||
|
||||
/* If no changes have been made, we can leave the transaction early.
|
||||
*/
|
||||
if( pPager->dbModified==0 &&
|
||||
|
@ -14,7 +14,7 @@
|
||||
# incorrectly write dirty pages out to the database (not safe to do
|
||||
# once the pager is in error state).
|
||||
#
|
||||
# $Id: ioerr5.test,v 1.2 2008/05/15 09:07:56 danielk1977 Exp $
|
||||
# $Id: ioerr5.test,v 1.3 2008/05/15 11:08:08 danielk1977 Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -84,7 +84,7 @@ foreach locking_mode {normal exclusive} {
|
||||
set nRow [db one {SELECT count(*) FROM a}]
|
||||
|
||||
# Dirty (at least) one of the pages in the cache.
|
||||
do_test ioerr5-$locking_mode-$iFail.1 {
|
||||
do_test ioerr5-1.$locking_mode-$iFail.1 {
|
||||
execsql {
|
||||
BEGIN EXCLUSIVE;
|
||||
INSERT INTO a VALUES(1, 'ABCDEFGHIJKLMNOP');
|
||||
@ -96,7 +96,7 @@ foreach locking_mode {normal exclusive} {
|
||||
#
|
||||
set ::sqlite_io_error_persist 1
|
||||
set ::sqlite_io_error_pending $iFail
|
||||
do_test ioerr5-$locking_mode-$iFail.2 {
|
||||
do_test ioerr5-1.$locking_mode-$iFail.2 {
|
||||
set rc [catchsql {COMMIT}]
|
||||
list
|
||||
} {}
|
||||
@ -116,7 +116,7 @@ foreach locking_mode {normal exclusive} {
|
||||
# from the pager that is in error state. Including that associated
|
||||
# with the dirty page.
|
||||
#
|
||||
do_test ioerr5-$locking_mode-$iFail.3 {
|
||||
do_test ioerr5-1.$locking_mode-$iFail.3 {
|
||||
sqlite3_soft_heap_limit 1024
|
||||
compilesql16 "SELECT 10"
|
||||
set bt [btree_from_db db]
|
||||
@ -127,7 +127,7 @@ foreach locking_mode {normal exclusive} {
|
||||
# Ensure that nothing was written to the database while reclaiming
|
||||
# memory from the pager in error state.
|
||||
#
|
||||
do_test ioerr5-$locking_mode-$iFail.4 {
|
||||
do_test ioerr5-1.$locking_mode-$iFail.4 {
|
||||
set fd [open test.db]
|
||||
fconfigure $fd -translation binary -encoding binary
|
||||
set zDatabase2 [read $fd]
|
||||
@ -136,7 +136,7 @@ foreach locking_mode {normal exclusive} {
|
||||
} {1}
|
||||
|
||||
if {$rc eq [list 0 {}]} {
|
||||
do_test ioerr5-$locking_mode-$iFail.3 {
|
||||
do_test ioerr5.1-$locking_mode-$iFail.3 {
|
||||
execsql { SELECT count(*) FROM a }
|
||||
} [expr $nRow+1]
|
||||
break
|
||||
@ -144,6 +144,55 @@ foreach locking_mode {normal exclusive} {
|
||||
}
|
||||
}
|
||||
|
||||
# Make sure this test script doesn't leave any files open.
|
||||
#
|
||||
do_test ioerr5-1.X {
|
||||
catch { db close }
|
||||
catch { db2 close }
|
||||
set sqlite_open_file_count
|
||||
} 0
|
||||
|
||||
do_test ioerr5-2.0 {
|
||||
sqlite3 db test.db
|
||||
execsql { CREATE INDEX i1 ON a(id, name); }
|
||||
} {}
|
||||
|
||||
foreach locking_mode {exclusive normal} {
|
||||
for {set iFail 1} {$iFail<200} {incr iFail} {
|
||||
sqlite3_soft_heap_limit 1048576
|
||||
opendatabases
|
||||
execsql { pragma locking_mode=exclusive }
|
||||
set nRow [db one {SELECT count(*) FROM a}]
|
||||
|
||||
do_test ioerr5-2.$locking_mode-$iFail.1 {
|
||||
execsql {
|
||||
BEGIN EXCLUSIVE;
|
||||
INSERT INTO a VALUES(1, 'ABCDEFGHIJKLMNOP');
|
||||
}
|
||||
} {}
|
||||
|
||||
set ::sqlite_io_error_persist 1
|
||||
set ::sqlite_io_error_pending $iFail
|
||||
|
||||
sqlite3_release_memory 10000
|
||||
|
||||
set error_hit $::sqlite_io_error_hit
|
||||
set ::sqlite_io_error_hit 0
|
||||
set ::sqlite_io_error_persist 0
|
||||
set ::sqlite_io_error_pending 0
|
||||
if {$error_hit} {
|
||||
do_test ioerr5-2.$locking_mode-$iFail.3a {
|
||||
catchsql COMMIT
|
||||
} {1 {disk I/O error}}
|
||||
} else {
|
||||
do_test ioerr5-2.$locking_mode-$iFail.3b {
|
||||
execsql COMMIT
|
||||
} {}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Make sure this test script doesn't leave any files open.
|
||||
#
|
||||
do_test ioerr5-2.X {
|
||||
|
Reference in New Issue
Block a user