mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-05 15:55:57 +03:00
Improved comment on the pager.c PERSIST rollback journal delete logic
inside of hasHotJournal(). No changes to code. FossilOrigin-Name: e5b17a9d07a35c9b44ff977ba81b93d745d26a11
This commit is contained in:
14
src/pager.c
14
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 ){
|
||||
|
Reference in New Issue
Block a user