1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

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
This commit is contained in:
dan
2010-06-30 04:36:03 +00:00
parent ba3cbf3d4b
commit 3ad5fd2502
3 changed files with 17 additions and 29 deletions

View File

@@ -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;