-C Define\s_GNU_SOURCE\sonly\sif\sit\sis\snot\salready\sdefined.\s\sTicket\s#3263.\s(CVS\s5514)
-D 2008-07-31T17:35:45
+C If\sxAccess()\sfails\swhile\sattempting\sto\sdetect\sa\shot-journal\sfile,\sdo\snot\sassume\sthat\sthe\serror\swas\san\sout-of-memory\scondition.\s(CVS\s5515)
+D 2008-08-01T10:50:23
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in bbb62eecc851379aef5a48a1bf8787eb13e6ec06
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/os_os2.c 676ed273b17bd260f905df81375c9f9950d85517
F src/os_unix.c fe0dbc35bcd3de49e46b132abfc0f45d6dd6a864
F src/os_win.c aefe9ee26430678a19a058a874e4e2bd91398142
-F src/pager.c a6ecad26297469a8a3d1fd7a7c3dc2d603955044
+F src/pager.c 6ad4d2b9b62a40f9ee898111d4519fec2e7c4796
F src/pager.h 588c1ac195228b2da45c4e5f7ab6c2fd253d1751
F src/parse.y d962e544d9953289db23c1d4cc2dab514c7136fa
F src/pragma.c 6e207b4f69901089758c02c02e0bf86ed12a4d8f
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P d43ff7bb8fc59c54b85658aaeb3dd088a324276f
-R e9616e8e48e4c16696138dc02f276c0f
-U drh
-Z 0d489aea3de9f958e0d9db5f75558e86
+P bc5abd31a7b5bc656edbb54c1c4523549d888056
+R fcbe4ad8b3e67d6472323658421c446a
+U danielk1977
+Z aceab1fca2abe9cb8b7e81fe04cfe121
** file simultaneously, or one process from reading the database while
** another is writing.
**
-** @(#) $Id: pager.c,v 1.467 2008/07/22 05:18:01 shane Exp $
+** @(#) $Id: pager.c,v 1.468 2008/08/01 10:50:23 danielk1977 Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
** is hot. The pager_playback() routine will discover that the
** journal file is not really hot and will no-op.
*/
-static int hasHotJournal(Pager *pPager){
+static int hasHotJournal(Pager *pPager, int *pExists){
sqlite3_vfs *pVfs = pPager->pVfs;
- int res = 0;
+ int rc = SQLITE_OK;
+ *pExists = 0;
if( pPager->useJournal && pPager->fd->pMethods ){
- int rc;
int exists;
int locked;
if( rc==SQLITE_OK && exists && !locked ){
int nPage;
rc = sqlite3PagerPagecount(pPager, &nPage);
- if( rc==SQLITE_OK && nPage==0 ){
- sqlite3OsDelete(pVfs, pPager->zJournal, 0);
- exists = 0;
+ if( rc==SQLITE_OK ){
+ if( nPage==0 ){
+ sqlite3OsDelete(pVfs, pPager->zJournal, 0);
+ }else{
+ *pExists = 1;
+ }
}
}
-
- res = (rc!=SQLITE_OK ? -1 : (exists && !locked));
}
- return res;
+ return rc;
}
/*
*/
static int pagerSharedLock(Pager *pPager){
int rc = SQLITE_OK;
- int isHot = 0;
+ int isErrorReset = 0;
/* If this database is opened for exclusive access, has no outstanding
** page references and is in an error-state, now is the chance to clear
*/
if( !MEMDB && pPager->exclusiveMode && pPager->nRef==0 && pPager->errCode ){
if( pPager->journalOpen ){
- isHot = 1;
+ isErrorReset = 1;
}
pPager->errCode = SQLITE_OK;
pager_reset(pPager);
return pPager->errCode;
}
- if( pPager->state==PAGER_UNLOCK || isHot ){
+ if( pPager->state==PAGER_UNLOCK || isErrorReset ){
sqlite3_vfs *pVfs = pPager->pVfs;
if( !MEMDB ){
+ int isHotJournal;
assert( pPager->nRef==0 );
if( !pPager->noReadlock ){
rc = pager_wait_on_lock(pPager, SHARED_LOCK);
/* If a journal file exists, and there is no RESERVED lock on the
** database file, then it either needs to be played back or deleted.
*/
- rc = hasHotJournal(pPager);
- if( rc<0 ){
- rc = SQLITE_IOERR_NOMEM;
- goto failed;
+ if( !isErrorReset ){
+ rc = hasHotJournal(pPager, &isHotJournal);
+ if( rc!=SQLITE_OK ){
+ goto failed;
+ }
}
- if( rc==1 || isHot ){
+ if( isErrorReset || isHotJournal ){
/* Get an EXCLUSIVE lock on the database file. At this point it is
** important that a RESERVED lock is not obtained on the way to the
** EXCLUSIVE lock. If it were, another process might open the
** OsTruncate() call used in exclusive-access mode also requires
** a read/write file handle.
*/
- if( !isHot && pPager->journalOpen==0 ){
+ if( !isErrorReset && pPager->journalOpen==0 ){
int res;
rc = sqlite3OsAccess(pVfs,pPager->zJournal,SQLITE_ACCESS_EXISTS,&res);
if( rc==SQLITE_OK ){