diff options
author | drh <drh@noemail.net> | 2014-03-07 14:57:07 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2014-03-07 14:57:07 +0000 |
commit | f3ccc38a697da306aee63e66c22c2d480d292875 (patch) | |
tree | badef80b4eafa50b03ebdb67d44b3ca6523a185d /src | |
parent | eb443925ef31cbdcfb42655f7a9aa44c65e4c102 (diff) | |
download | sqlite-f3ccc38a697da306aee63e66c22c2d480d292875.tar.gz sqlite-f3ccc38a697da306aee63e66c22c2d480d292875.zip |
Improved comment on the pager.c PERSIST rollback journal delete logic
inside of hasHotJournal(). No changes to code.
FossilOrigin-Name: e5b17a9d07a35c9b44ff977ba81b93d745d26a11
Diffstat (limited to 'src')
-rw-r--r-- | src/pager.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/pager.c b/src/pager.c index e2486caa0..c6485a4d4 100644 --- a/src/pager.c +++ b/src/pager.c @@ -4889,14 +4889,16 @@ static int hasHotJournal(Pager *pPager, int *pExists){ if( rc==SQLITE_OK && !locked ){ Pgno nPage; /* Number of pages in database file */ - /* Check the size of the database file. If it consists of 0 pages - ** and the journal is not being persisted, then delete the journal - ** file. See the header comment above for the reasoning here. - ** Delete the obsolete journal file under a RESERVED lock to avoid - ** race conditions and to avoid violating [H33020]. - */ rc = pagerPagecount(pPager, &nPage); if( rc==SQLITE_OK ){ + /* If the database is zero pages in size, that means that either (1) the + ** journal is a remnant from a prior database with the same name where + ** the database file but not the journal was deleted, or (2) the initial + ** transaction that populates a new database is being rolled back. + ** In either case, the journal file can be deleted. However, take care + ** not to delete the journal file if it is already open due to + ** journal_mode=PERSIST. + */ if( nPage==0 && !jrnlOpen ){ sqlite3BeginBenignMalloc(); if( pagerLockDb(pPager, RESERVED_LOCK)==SQLITE_OK ){ |