1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Avoid calling sqlite3OsDelete() on a file that is open, since this causes Windows to run *very* slowly. Comes up on error recovery in journal_mode=PERSIST.

FossilOrigin-Name: fdc651e2ec7a0babee669e24fd56632e7cd5f0e9
This commit is contained in:
mistachkin
2014-03-07 02:29:56 +00:00
parent f0ec2a5ea7
commit 8879481868
4 changed files with 17 additions and 15 deletions

View File

@@ -4889,15 +4889,15 @@ 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,
** 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].
/* 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( nPage==0 ){
if( nPage==0 && pPager->journalMode!=PAGER_JOURNALMODE_PERSIST ){
sqlite3BeginBenignMalloc();
if( pagerLockDb(pPager, RESERVED_LOCK)==SQLITE_OK ){
sqlite3OsDelete(pVfs, pPager->zJournal, 0);