]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix the pager so that it handles persistent I/O errors correctly.
authordrh <drh@noemail.net>
Thu, 15 Mar 2007 12:51:16 +0000 (12:51 +0000)
committerdrh <drh@noemail.net>
Thu, 15 Mar 2007 12:51:16 +0000 (12:51 +0000)
Update the testing infrastructure so that it tests for persistent
I/O errors instead of just transient errors. (CVS 3690)

FossilOrigin-Name: ea8507a796c65041f7e720edea89f919fca1a028

manifest
manifest.uuid
src/os_common.h
src/pager.c
test/diskfull.test

index 2a265ab8187ef1e2d702f205a12d0cf7679fd1a9..c315bcf06f43e6a0657bd5d3fd085b144ead9d15 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Infrastructure\sto\smake\ssimulated\sI/O\serrors\spersistent\sinstead\sof\ntransient.\s(CVS\s3689)
-D 2007-03-15T12:17:43
+C Fix\sthe\spager\sso\sthat\sit\shandles\spersistent\sI/O\serrors\scorrectly.\nUpdate\sthe\stesting\sinfrastructure\sso\sthat\sit\stests\sfor\spersistent\nI/O\serrors\sinstead\sof\sjust\stransient\serrors.\s(CVS\s3690)
+D 2007-03-15T12:51:16
 F Makefile.in 1fe3d0b46e40fd684e1e61f8e8056cefed16de9f
 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -77,7 +77,7 @@ F src/main.c af8922e0205cf618392de2836c9efad71786d0d6
 F src/md5.c c5fdfa5c2593eaee2e32a5ce6c6927c986eaf217
 F src/os.c 59f05de8c5777c34876607114a2fbe55ae578235
 F src/os.h 17fc73165cb7436aa79492d2dff754baec74fcb9
-F src/os_common.h 4ee94e3ba305cf92488fa7e54e5c98fb03fa7ddc
+F src/os_common.h 970899e83de0ba177d6fbdf9d700457fa3c6df8c
 F src/os_os2.c 8ee8207fe218a1acf3a31d59753e165e5c23bb95
 F src/os_os2.h e5f17dd69333632bbc3112881ea407c37d245eb3
 F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c
@@ -86,7 +86,7 @@ F src/os_unix.c a3b26ad8270aea899f9d65fd2e6a176b05d2ef8f
 F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
 F src/os_win.c 8736cf3a49fd651a6538857480f302807d57814c
 F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
-F src/pager.c 999194d214872e5c04a50700778571cc2238d1c0
+F src/pager.c ccca82d0f6644b95fd4f985d7049f1505443f048
 F src/pager.h 8881591ca23d1e5fd83c95fa8317245fbcf64227
 F src/parse.y bcfe366c1fd61cfc40e5344eb69a31997a821af0
 F src/pragma.c b52dcf2fbb46f3266f9d00b88054c684df3af2e7
@@ -193,7 +193,7 @@ F test/delete3.test 555e84a00a99230b7d049d477a324a631126a6ab
 F test/descidx1.test 2177c4ad55edcf56ad5f4c6490f307d7774e8a10
 F test/descidx2.test eb3a2882ec58aa6e1e8131d9bb54436e5b4a3ce2
 F test/descidx3.test 3a55b8d73bc3e9ad084e0da7fec781cf0d2a0356
-F test/diskfull.test d828d72adfc9e2d1a194d25996718c1989152cf9
+F test/diskfull.test 2321eae64325102e1c5fb2f92a99c5c1f94bb95a
 F test/distinctagg.test 2b89d1c5220d966a30ba4b40430338669301188b
 F test/enc.test 7a03417a1051fe8bc6c7641cf4c8c3f7e0066d52
 F test/enc2.test 45710bacfa9df29720bc84c067dfdf8c8ddfb797
@@ -436,7 +436,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P 760ebf8076b9cedb614bdc88c72d871c30cc7b94
-R a54dd85814a4f198d27a7b3bc55243a7
+P 1a53f531ecd51938fab37a59b7088d89d8f8569d
+R 3660727ee8d0612f6e273df51bd49941
 U drh
-Z da48ce4b728b6695aadd7e57b610d24b
+Z 7fe43a32146926ecb006444cd47d8efc
index f6719e57364d5d6990467906e783d5ffdc4d433a..ba8a5e2ca705e83ae3c5fb3521934b8b7b9600a3 100644 (file)
@@ -1 +1 @@
-1a53f531ecd51938fab37a59b7088d89d8f8569d
\ No newline at end of file
+ea8507a796c65041f7e720edea89f919fca1a028
\ No newline at end of file
index 3d379e070e1ffb085358c0f6b0bda8464aee5257..ef340b8401e5a7357909e08ad214b66c1730f6be 100644 (file)
@@ -94,7 +94,7 @@ int sqlite3_io_error_persist = 0;
 int sqlite3_diskfull_pending = 0;
 int sqlite3_diskfull = 0;
 #define SimulateIOError(CODE)  \
-   if( sqlite3_io_error_pending ) \
+  if( sqlite3_io_error_pending || sqlite3_io_error_hit ) \
      if( sqlite3_io_error_pending-- == 1 \
          || (sqlite3_io_error_persist && sqlite3_io_error_hit) ) \
                 { local_ioerr(); CODE; }
@@ -106,6 +106,7 @@ static void local_ioerr(){
      if( sqlite3_diskfull_pending == 1 ){ \
        local_ioerr(); \
        sqlite3_diskfull = 1; \
+       sqlite3_io_error_hit = 1; \
        CODE; \
      }else{ \
        sqlite3_diskfull_pending--; \
index 2f4eb5e12fdb689763a9842950b7ad2ceff2dece..b795fd3bf50eb037ccf789e5f6edaa7291d056f2 100644 (file)
@@ -18,7 +18,7 @@
 ** file simultaneously, or one process from reading the database while
 ** another is writing.
 **
-** @(#) $Id: pager.c,v 1.287 2007/03/15 01:16:48 drh Exp $
+** @(#) $Id: pager.c,v 1.288 2007/03/15 12:51:16 drh Exp $
 */
 #ifndef SQLITE_OMIT_DISKIO
 #include "sqliteInt.h"
@@ -1860,6 +1860,9 @@ int sqlite3pager_pagecount(Pager *pPager){
   i64 n;
   int rc;
   assert( pPager!=0 );
+  if( pPager->errCode ){
+    return 0;
+  }
   if( pPager->dbSize>=0 ){
     n = pPager->dbSize;
   } else {
index 690eb801f4e7bb1d8ab2a0548db394d0ab45d748..07e3c6b19cf21584915cd192f60f284c0a1b2c80 100644 (file)
 # focus of this file is testing for correct handling of disk full
 # errors.
 # 
-# $Id: diskfull.test,v 1.3 2005/09/09 10:46:19 drh Exp $
+# $Id: diskfull.test,v 1.4 2007/03/15 12:51:17 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
 
+set sqlite_io_error_persist 0
+set sqlite_io_error_hit 0
+set sqlite_io_error_pending 0
 do_test diskfull-1.1 {
   execsql {
     CREATE TABLE t1(x);
@@ -47,6 +50,7 @@ do_test diskfull-1.5 {
   }
 } {1 {database or disk is full}}
 set sqlite_diskfull_pending 0
+set sqlite_io_error_hit 0
 integrity_check diskfull-1.6
 
 set go 1