diff options
author | dan <dan@noemail.net> | 2010-06-30 04:36:03 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2010-06-30 04:36:03 +0000 |
commit | 3ad5fd2502adb0b60da7e7019d6a0093b72ba7ac (patch) | |
tree | 18f962aff0face9e57a2b7e4e37aa47cb4f731fb /src | |
parent | ba3cbf3d4bdb09d6dacf52e9232b903b5c6a1c14 (diff) | |
download | sqlite-3ad5fd2502adb0b60da7e7019d6a0093b72ba7ac.tar.gz sqlite-3ad5fd2502adb0b60da7e7019d6a0093b72ba7ac.zip |
Do not call pager_open_journal() from within PagerBegin() if the connection is in exclusive-access mode. It will be called from within PagerWrite() just as it is for non-exclusive mode anyway.
FossilOrigin-Name: cdf2c5c2dd2e4404ffb85a680d31307afea266eb
Diffstat (limited to 'src')
-rw-r--r-- | src/pager.c | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/src/pager.c b/src/pager.c index 048128765..064e81127 100644 --- a/src/pager.c +++ b/src/pager.c @@ -4634,30 +4634,19 @@ int sqlite3PagerBegin(Pager *pPager, int exFlag, int subjInMemory){ ** we might save the work of creating a file if the transaction ** ends up being a no-op. */ - }else if( isOpen(pPager->jfd) && pPager->journalOff==0 ){ - /* This happens when the pager was in exclusive-access mode the last - ** time a (read or write) transaction was successfully concluded - ** by this connection. Instead of deleting the journal file it was - ** kept open and either was truncated to 0 bytes or its header was - ** overwritten with zeros. - */ - assert( pagerUseWal(pPager)==0 ); - assert( pPager->nRec==0 ); - assert( pPager->dbOrigSize==0 ); - assert( pPager->pInJournal==0 ); - rc = pager_open_journal(pPager); + + if( rc!=SQLITE_OK ){ + assert( !pPager->dbModified ); + /* Ignore any IO error that occurs within pager_end_transaction(). The + ** purpose of this call is to reset the internal state of the pager + ** sub-system. It doesn't matter if the journal-file is not properly + ** finalized at this point (since it is not a valid journal file anyway). + */ + pager_end_transaction(pPager, 0); + } } PAGERTRACE(("TRANSACTION %d\n", PAGERID(pPager))); - if( rc!=SQLITE_OK ){ - assert( !pPager->dbModified ); - /* Ignore any IO error that occurs within pager_end_transaction(). The - ** purpose of this call is to reset the internal state of the pager - ** sub-system. It doesn't matter if the journal-file is not properly - ** finalized at this point (since it is not a valid journal file anyway). - */ - pager_end_transaction(pPager, 0); - } return rc; } @@ -4708,7 +4697,6 @@ static int pager_write(PgHdr *pPg){ ** which means they have acquired the necessary locks but the rollback ** journal might not yet be open. */ - assert( pPager->state>PAGER_SHARED ); rc = sqlite3PagerBegin(pPager, 0, pPager->subjInMemory); if( rc!=SQLITE_OK ){ return rc; |