]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
The hasHotJournal() fix of check-in (6687) causes some minor problems in
authordrh <drh@noemail.net>
Fri, 29 May 2009 10:55:29 +0000 (10:55 +0000)
committerdrh <drh@noemail.net>
Fri, 29 May 2009 10:55:29 +0000 (10:55 +0000)
various alternative operating modes, such as locking_mode=EXCLUSIVE.  This
additional patch attempts to fix those concerns.  Ticket #3883. (CVS 6688)

FossilOrigin-Name: a2ba61d927a06c390a9a818a013328092b802222

manifest
manifest.uuid
src/pager.c

index 0e999c04662e4126f22f049a9ff9ba402e8ed2dd..1e412260458770e7f832d0f7238eabc968b5ccfe 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Modify\sthe\shasHotJournal()\sroutine\sto\sreturn\sa\sfalse-positive\sif\sit\sis\nunable\sto\sopen\sthe\sjournal\sfile\sto\scheck\sits\sheader\sdue\sto\sa\srace\ncondition.\s\sProcessing\sdownstream\sof\shasHotJournal()\salready\sknows\show\sto\ndeal\swith\sfalse-positives.\s\sTicket\s#3883.\s(CVS\s6687)
-D 2009-05-29T00:30:30
+C The\shasHotJournal()\sfix\sof\scheck-in\s(6687)\scauses\ssome\sminor\sproblems\sin\nvarious\salternative\soperating\smodes,\ssuch\sas\slocking_mode=EXCLUSIVE.\s\sThis\nadditional\spatch\sattempts\sto\sfix\sthose\sconcerns.\s\sTicket\s#3883.\s(CVS\s6688)
+D 2009-05-29T10:55:30
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in 583e87706abc3026960ed759aff6371faf84c211
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -146,7 +146,7 @@ F src/os_common.h 8c61457df58f1a4bd5f5adc3e90e01b37bf7afbc
 F src/os_os2.c bed77dc26e3a95ce4a204936b9a1ca6fe612fcc5
 F src/os_unix.c e55d977c516ed880a2f83f0610b019efd9f8bc06
 F src/os_win.c 725c38a524d168ce280446ad8761d731bc516405
-F src/pager.c 6c0fc1c078fcdeefe969a36a186fb147c459c600
+F src/pager.c e8d7bb38b017f69592ef60c29e079e98116e9169
 F src/pager.h 73f481a308a873ccd626d97331c081db3b53e2e5
 F src/parse.y 07690df997d50b3fdb5e5121e5a27f1a080db13d
 F src/pcache.c 395f752a13574120bd7513a400ba02a265aaa76d
@@ -731,7 +731,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 6ae4ad6ebee4db88c411df97bb1de574708dd53c
-R 3928c5dff5e5480b3ec95781956d3c18
+P d6b5d8e1ab8e5d3348ace560230702718a2a8af9
+R 0ac9e3aa3a83dcf8ee0374add80abf93
 U drh
-Z a92eea42d5738ee5a30dde1c2bfece9a
+Z 63f4ce5bec4a9085ab67577f4243a291
index 89fad15bced1c6cd83bc4cfed36aff0d203bc434..8e2f8a0d3acf5c71072a4569e02ee0a4acd07ffc 100644 (file)
@@ -1 +1 @@
-d6b5d8e1ab8e5d3348ace560230702718a2a8af9
\ No newline at end of file
+a2ba61d927a06c390a9a818a013328092b802222
\ No newline at end of file
index c4c785147d5aea99ddd056ffde45940867d86551..98f93116c2f34d72552b21f64c0ebccd58be07e4 100644 (file)
@@ -18,7 +18,7 @@
 ** file simultaneously, or one process from reading the database while
 ** another is writing.
 **
-** @(#) $Id: pager.c,v 1.588 2009/05/29 00:30:30 drh Exp $
+** @(#) $Id: pager.c,v 1.589 2009/05/29 10:55:30 drh Exp $
 */
 #ifndef SQLITE_OMIT_DISKIO
 #include "sqliteInt.h"
@@ -3405,10 +3405,15 @@ static int hasHotJournal(Pager *pPager, int *pExists){
       rc = sqlite3PagerPagecount(pPager, &nPage);
       if( rc==SQLITE_OK ){
         if( nPage==0 ){
-          if( sqlite3OsLock(pPager->fd, RESERVED_LOCK)==SQLITE_OK ){
+          sqlite3BeginBenignMalloc();
+          if( pPager->exclusiveMode
+                 ||  sqlite3OsLock(pPager->fd, RESERVED_LOCK)==SQLITE_OK ){
             sqlite3OsDelete(pVfs, pPager->zJournal, 0);
-            sqlite3OsUnlock(pPager->fd, SHARED_LOCK);
+            if( !pPager->exclusiveMode ){
+              sqlite3OsUnlock(pPager->fd, SHARED_LOCK);
+            }
           }
+          sqlite3EndBenignMalloc();
         }else{
           /* The journal file exists and no other connection has a reserved
           ** or greater lock on the database file. Now check that there is
@@ -3426,7 +3431,7 @@ static int hasHotJournal(Pager *pPager, int *pExists){
             }
             sqlite3OsClose(pPager->jfd);
             *pExists = (first!=0);
-          }else{
+          }else if( rc==SQLITE_CANTOPEN ){
             /* If we cannot open the rollback journal file in order to see if
             ** its has a zero header, that might be due to an I/O error, or
             ** it might be due to the race condition described above and in