]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix some problems with test cases in shared_err.test. Also a real bug causing a segfa...
authordanielk1977 <danielk1977@noemail.net>
Mon, 19 Mar 2007 13:53:37 +0000 (13:53 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Mon, 19 Mar 2007 13:53:37 +0000 (13:53 +0000)
FossilOrigin-Name: 9f62ef1ec385d9f1a1913439dc4c2d710373f12a

manifest
manifest.uuid
src/pager.c
test/shared_err.test

index 86986efb673c301d54a0a8b5eea82d6f301fcfa2..b170f0e40bcfc8ba905987a482ff30b2d3056828 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\scomment\sin\sbtree.c\s(CVS\s3702)
-D 2007-03-19T11:54:10
+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-19T13:53:38
 F Makefile.in 1fe3d0b46e40fd684e1e61f8e8056cefed16de9f
 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -86,7 +86,7 @@ F src/os_unix.c 33ee7c1483fbd4d67cf5638c87622c277442b744
 F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
 F src/os_win.c f3ca3e08167eb3382781b840e787809eccb626dc
 F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
-F src/pager.c c276e9de4e77d1c3d72367a7e207fa82e0e74af3
+F src/pager.c 3688e882a10a693cbdc9303426d3a52b8f48ccd5
 F src/pager.h 8881591ca23d1e5fd83c95fa8317245fbcf64227
 F src/parse.y bcfe366c1fd61cfc40e5344eb69a31997a821af0
 F src/pragma.c b52dcf2fbb46f3266f9d00b88054c684df3af2e7
@@ -296,7 +296,7 @@ F test/server1.test e328b8e641ba8fe9273132cfef497383185dc1f5
 F test/shared.test 0ed247941236788c255b3b29b5a82d5ca71b6432
 F test/shared2.test 8b48f8d33494413ef4cf250110d89403e2bf6b23
 F test/shared3.test 01e3e124dbb3859788aabc7cfb82f7ea04421749
-F test/shared_err.test 299a9180a6376b2089e8e0d469f383fe91bfa4ff
+F test/shared_err.test 841f7341eb07ed97c713bf89960a4e9199717193
 F test/sort.test 0e4456e729e5a92a625907c63dcdedfbe72c5dc5
 F test/speed1.test 4d6719b252fe90dc52f663a6b2a24cf6472ceac9
 F test/subquery.test ae324ee928c5fb463a3ce08a8860d6e7f1ca5797
@@ -437,7 +437,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P 3a3e8eb25d8e04cfccc5c0513ed04efcc25d3dbf
-R a297b1419430310b47806366b750440a
-U drh
-Z 55992e8d0ba687290ede6e38f8418c27
+P 05700c11a9e5177a437d2240e72fb61ea47b973b
+R 5b98dd2b31d3223324e5610c7e38647f
+U danielk1977
+Z e38c1767e7ac582db2f50d60881eead5
index 200fd54ba3809bff11f826d5dda166011ccb8401..e066da992a3d32680d024178516ac0a4993633d8 100644 (file)
@@ -1 +1 @@
-05700c11a9e5177a437d2240e72fb61ea47b973b
\ No newline at end of file
+9f62ef1ec385d9f1a1913439dc4c2d710373f12a
\ No newline at end of file
index b2ada00419ea0fc987999e01cf79148e5cbb4617..68c06947a5cc2a4b247a45aa6c688d3faaf742cc 100644 (file)
@@ -18,7 +18,7 @@
 ** file simultaneously, or one process from reading the database while
 ** 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
 #include "sqliteInt.h"
@@ -880,6 +880,7 @@ static void pager_reset(Pager *pPager){
     pNext = pPg->pNextAll;
     sqliteFree(pPg);
   }
+  pPager->pStmt = 0;
   pPager->pFirst = 0;
   pPager->pFirstSynced = 0;
   pPager->pLast = 0;
index 0fe0220eac08226d6798a61fc584a9354a39fa86..e4ba31c3ae746ae37239af56ab52cb3cf802c9b6 100644 (file)
@@ -13,7 +13,7 @@
 # cache context. What happens to connection B if one connection A encounters
 # 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} {}
 
@@ -28,7 +28,6 @@ ifcapable !shared_cache||!subquery {
 }
 set ::enable_shared_cache [sqlite3_enable_shared_cache 1]
 
-
 # Todo: This is a copy of the [do_malloc_test] proc in malloc.test
 # It would be better if these were consolidated.
 
@@ -256,15 +255,49 @@ do_ioerr_test shared_ioerr-3 -tclprep {
     COMMIT;
   }
 } -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 {
-    sqlite3_step $::STMT
-  } {SQLITE_ROW}
+    expr {
+      $::steprc eq "SQLITE_ROW" || 
+      $::steprc eq "SQLITE_ERROR" ||
+      $::steprc eq "SQLITE_ABORT" 
+    }
+  } {1}
   do_test shared_ioerr-3.$n.cleanup.2 {
-    sqlite3_column_text $::STMT 0
-  } {002.002.002.002.002}
+    expr {
+      ($::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 {
-    sqlite3_finalize $::STMT
-  } {SQLITE_OK}
+    expr {
+      ($::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 close
 }