]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
If an IO error is encountered on a commit, close the journal so that it
authordrh <drh@noemail.net>
Mon, 2 Apr 2007 11:22:22 +0000 (11:22 +0000)
committerdrh <drh@noemail.net>
Mon, 2 Apr 2007 11:22:22 +0000 (11:22 +0000)
persists and can (hopefully) rollback the failed transaction later. (CVS 3792)

FossilOrigin-Name: 22e10cc24e4407feb276abfa8cc9964f20c6e54a

manifest
manifest.uuid
src/pager.c

index b4544772b2cbd40bd35abd554ebce0c8d8c0d351..3e202f83d2970a9bb1472492bd96b3e209636786 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Correctly\shandle\sthe\sobscure\scase\sof\sa\sread-only\shot-journal\sfile.\s(CVS\s3791)
-D 2007-04-02T11:08:59
+C If\san\sIO\serror\sis\sencountered\son\sa\scommit,\sclose\sthe\sjournal\sso\sthat\sit\npersists\sand\scan\s(hopefully)\srollback\sthe\sfailed\stransaction\slater.\s(CVS\s3792)
+D 2007-04-02T11:22:22
 F Makefile.in 2f2c3bf69faf0ae7b8e8af4f94f1986849034530
 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -86,7 +86,7 @@ F src/os_unix.c ccb003fb9fadc032924d3efb3fa8cc69fd9e176b
 F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
 F src/os_win.c c9a99524d6b2bdec636264cad1b67553925e3309
 F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
-F src/pager.c 0583079cb746f96702b7351b0cda346be4c02da8
+F src/pager.c 30e4a54e4ce9817839043eaa8968aace95f73ed9
 F src/pager.h e79a24cf200b8771366217f5bca414f5b7823f42
 F src/parse.y 207ab04273ae13aa4a729b96008d294d5f334ab3
 F src/pragma.c 3b992b5b2640d6ae25cef05aa6a42cd1d6c43234
@@ -448,7 +448,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P ba0538a4977aefd6645554f1989f0a98b540b9cd
-R fe59b9bdc90ed7270cae7cde15f7b2a0
-U danielk1977
-Z 614d37969660406bc4f5f28fc9575c7e
+P 4d8c6bf44ec00ec04e615983cb33425ca2c3998a
+R b60be37f8194d17dcc865a186ba19df6
+U drh
+Z 36541dd9060dc60ff27a9aed65ba02c4
index 2d47b7cea179b4b7898dd08cd56eb3b54c1e831e..7e35a411b886b3e2b807352aba30e3ed325d88a1 100644 (file)
@@ -1 +1 @@
-4d8c6bf44ec00ec04e615983cb33425ca2c3998a
\ No newline at end of file
+22e10cc24e4407feb276abfa8cc9964f20c6e54a
\ No newline at end of file
index 4ec2377294316a557b432d9b42a1105ad2f596f8..27d659d69e4f100dd3d92ce5957101b64fd83b00 100644 (file)
@@ -18,7 +18,7 @@
 ** file simultaneously, or one process from reading the database while
 ** another is writing.
 **
-** @(#) $Id: pager.c,v 1.315 2007/04/02 11:08:59 danielk1977 Exp $
+** @(#) $Id: pager.c,v 1.316 2007/04/02 11:22:22 drh Exp $
 */
 #ifndef SQLITE_OMIT_DISKIO
 #include "sqliteInt.h"
@@ -942,26 +942,15 @@ static int pager_end_transaction(Pager *pPager){
     pPager->stmtOpen = 0;
   }
   if( pPager->journalOpen ){
-    if( pPager->exclusiveMode ){
-      rc = sqlite3OsTruncate(pPager->jfd, 0);
+    if( pPager->exclusiveMode 
+          && (rc = sqlite3OsTruncate(pPager->jfd, 0))==SQLITE_OK ){;
       sqlite3OsSeek(pPager->jfd, 0);
       pPager->journalOff = 0;
       pPager->journalStarted = 0;
     }else{
       sqlite3OsClose(&pPager->jfd);
       pPager->journalOpen = 0;
-      /* If this is a temporary pager file, then the journal file should
-      ** have been configured as delete-on-close. Otherwise, it should still
-      ** be in the file system. This pager still holds a RESERVED or greater
-      ** lock on the database file, so there is no chance another process
-      ** could create or remove a journal file.
-      **
-      ** These asserts are not valid for asynchronous I/O such as is found
-      ** in async.test
-      */
-      /*assert( sqlite3OsFileExists(pPager->zJournal) || pPager->tempFile );*/
-      /*assert( !sqlite3OsFileExists(pPager->zJournal) || !pPager->tempFile );*/
-      if( !pPager->tempFile ){
+      if( rc==SQLITE_OK ){
         rc = sqlite3OsDelete(pPager->zJournal);
       }
     }
@@ -3188,20 +3177,6 @@ static int pager_open_journal(Pager *pPager){
 failed_to_open_journal:
   sqliteFree(pPager->aInJournal);
   pPager->aInJournal = 0;
-#if 0
-  if( rc==SQLITE_NOMEM ){
-    /* If this was a malloc() failure, then we will not be closing the pager
-    ** file. So delete any journal file we may have just created. Otherwise,
-    ** the system will get confused, we have a read-lock on the file and a
-    ** mysterious journal has appeared in the filesystem.
-    */
-    /* sqlite3OsDelete(pPager->zJournal); */
-  }else{
-    /* If we reset the pager here, we will delete pages out from under
-    ** various cursors and will ultimately segfault. */
-    /* pager_reset(pPager); */
-  }
-#endif
   return rc;
 }