1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Fix some problems with test cases in shared_err.test. Also a real bug causing a segfault after an IO error in pager.c. (CVS 3703)

FossilOrigin-Name: 9f62ef1ec385d9f1a1913439dc4c2d710373f12a
This commit is contained in:
danielk1977
2007-03-19 13:53:37 +00:00
parent fe5d71dd7f
commit b94bf855b2
4 changed files with 52 additions and 18 deletions

View File

@ -1,5 +1,5 @@
C Fix\sa\scomment\sin\sbtree.c\s(CVS\s3702) C Fix\ssome\sproblems\swith\stest\scases\sin\sshared_err.test.\sAlso\sa\sreal\sbug\scausing\sa\ssegfault\safter\san\sIO\serror\sin\spager.c.\s(CVS\s3703)
D 2007-03-19T11:54:10 D 2007-03-19T13:53:38
F Makefile.in 1fe3d0b46e40fd684e1e61f8e8056cefed16de9f F Makefile.in 1fe3d0b46e40fd684e1e61f8e8056cefed16de9f
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -86,7 +86,7 @@ F src/os_unix.c 33ee7c1483fbd4d67cf5638c87622c277442b744
F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
F src/os_win.c f3ca3e08167eb3382781b840e787809eccb626dc F src/os_win.c f3ca3e08167eb3382781b840e787809eccb626dc
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
F src/pager.c c276e9de4e77d1c3d72367a7e207fa82e0e74af3 F src/pager.c 3688e882a10a693cbdc9303426d3a52b8f48ccd5
F src/pager.h 8881591ca23d1e5fd83c95fa8317245fbcf64227 F src/pager.h 8881591ca23d1e5fd83c95fa8317245fbcf64227
F src/parse.y bcfe366c1fd61cfc40e5344eb69a31997a821af0 F src/parse.y bcfe366c1fd61cfc40e5344eb69a31997a821af0
F src/pragma.c b52dcf2fbb46f3266f9d00b88054c684df3af2e7 F src/pragma.c b52dcf2fbb46f3266f9d00b88054c684df3af2e7
@ -296,7 +296,7 @@ F test/server1.test e328b8e641ba8fe9273132cfef497383185dc1f5
F test/shared.test 0ed247941236788c255b3b29b5a82d5ca71b6432 F test/shared.test 0ed247941236788c255b3b29b5a82d5ca71b6432
F test/shared2.test 8b48f8d33494413ef4cf250110d89403e2bf6b23 F test/shared2.test 8b48f8d33494413ef4cf250110d89403e2bf6b23
F test/shared3.test 01e3e124dbb3859788aabc7cfb82f7ea04421749 F test/shared3.test 01e3e124dbb3859788aabc7cfb82f7ea04421749
F test/shared_err.test 299a9180a6376b2089e8e0d469f383fe91bfa4ff F test/shared_err.test 841f7341eb07ed97c713bf89960a4e9199717193
F test/sort.test 0e4456e729e5a92a625907c63dcdedfbe72c5dc5 F test/sort.test 0e4456e729e5a92a625907c63dcdedfbe72c5dc5
F test/speed1.test 4d6719b252fe90dc52f663a6b2a24cf6472ceac9 F test/speed1.test 4d6719b252fe90dc52f663a6b2a24cf6472ceac9
F test/subquery.test ae324ee928c5fb463a3ce08a8860d6e7f1ca5797 F test/subquery.test ae324ee928c5fb463a3ce08a8860d6e7f1ca5797
@ -437,7 +437,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P 3a3e8eb25d8e04cfccc5c0513ed04efcc25d3dbf P 05700c11a9e5177a437d2240e72fb61ea47b973b
R a297b1419430310b47806366b750440a R 5b98dd2b31d3223324e5610c7e38647f
U drh U danielk1977
Z 55992e8d0ba687290ede6e38f8418c27 Z e38c1767e7ac582db2f50d60881eead5

View File

@ -1 +1 @@
05700c11a9e5177a437d2240e72fb61ea47b973b 9f62ef1ec385d9f1a1913439dc4c2d710373f12a

View File

@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while ** file simultaneously, or one process from reading the database while
** another is writing. ** another is writing.
** **
** @(#) $Id: pager.c,v 1.290 2007/03/19 11:25:20 danielk1977 Exp $ ** @(#) $Id: pager.c,v 1.291 2007/03/19 13:53:38 danielk1977 Exp $
*/ */
#ifndef SQLITE_OMIT_DISKIO #ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h" #include "sqliteInt.h"
@ -880,6 +880,7 @@ static void pager_reset(Pager *pPager){
pNext = pPg->pNextAll; pNext = pPg->pNextAll;
sqliteFree(pPg); sqliteFree(pPg);
} }
pPager->pStmt = 0;
pPager->pFirst = 0; pPager->pFirst = 0;
pPager->pFirstSynced = 0; pPager->pFirstSynced = 0;
pPager->pLast = 0; pPager->pLast = 0;

View File

@ -13,7 +13,7 @@
# cache context. What happens to connection B if one connection A encounters # cache context. What happens to connection B if one connection A encounters
# an IO-error whilst reading or writing the file-system? # an IO-error whilst reading or writing the file-system?
# #
# $Id: shared_err.test,v 1.9 2006/01/24 16:37:59 danielk1977 Exp $ # $Id: shared_err.test,v 1.10 2007/03/19 13:53:38 danielk1977 Exp $
proc skip {args} {} proc skip {args} {}
@ -28,7 +28,6 @@ ifcapable !shared_cache||!subquery {
} }
set ::enable_shared_cache [sqlite3_enable_shared_cache 1] set ::enable_shared_cache [sqlite3_enable_shared_cache 1]
# Todo: This is a copy of the [do_malloc_test] proc in malloc.test # Todo: This is a copy of the [do_malloc_test] proc in malloc.test
# It would be better if these were consolidated. # It would be better if these were consolidated.
@ -256,15 +255,49 @@ do_ioerr_test shared_ioerr-3 -tclprep {
COMMIT; COMMIT;
} }
} -cleanup { } -cleanup {
set ::steprc [sqlite3_step $::STMT]
set ::column [sqlite3_column_text $::STMT 0]
set ::finalrc [sqlite3_finalize $::STMT]
# There are three possible outcomes here (assuming persistent IO errors):
#
# 1. If the [sqlite3_step] did not require any IO (required pages in
# the cache), then the next row ("002...") may be retrieved
# successfully.
#
# 2. If the [sqlite3_step] does require IO, then [sqlite3_step] returns
# SQLITE_ERROR and [sqlite3_finalize] returns IOERR.
#
# 3. If, after the initial IO error, SQLite tried to rollback the
# active transaction and a second IO error was encountered, then
# statement $::STMT will have been aborted. This means [sqlite3_stmt]
# returns SQLITE_ABORT, and the statement cursor does not move. i.e.
# [sqlite3_column] still returns the current row ("001...") and
# [sqlite3_finalize] returns SQLITE_OK.
#
do_test shared_ioerr-3.$n.cleanup.1 { do_test shared_ioerr-3.$n.cleanup.1 {
sqlite3_step $::STMT expr {
} {SQLITE_ROW} $::steprc eq "SQLITE_ROW" ||
$::steprc eq "SQLITE_ERROR" ||
$::steprc eq "SQLITE_ABORT"
}
} {1}
do_test shared_ioerr-3.$n.cleanup.2 { do_test shared_ioerr-3.$n.cleanup.2 {
sqlite3_column_text $::STMT 0 expr {
} {002.002.002.002.002} ($::steprc eq "SQLITE_ROW" && $::column eq "002.002.002.002.002") ||
($::steprc eq "SQLITE_ERROR" && $::column eq "") ||
($::steprc eq "SQLITE_ABORT" && $::column eq "001.001.001.001.001")
}
} {1}
do_test shared_ioerr-3.$n.cleanup.3 { do_test shared_ioerr-3.$n.cleanup.3 {
sqlite3_finalize $::STMT expr {
} {SQLITE_OK} ($::steprc eq "SQLITE_ROW" && $::finalrc eq "SQLITE_OK") ||
($::steprc eq "SQLITE_ERROR" && $::finalrc eq "SQLITE_IOERR") ||
($::steprc eq "SQLITE_ABORT" && $::finalrc eq "SQLITE_OK")
}
} {1}
# db2 eval {select * from sqlite_master} # db2 eval {select * from sqlite_master}
db2 close db2 close
} }