/ Check-in [fdc651e2]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment: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.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:fdc651e2ec7a0babee669e24fd56632e7cd5f0e9
User & Date: mistachkin 2014-03-07 02:29:56
Context
2014-03-07
03:31
Revise change from the previous check-in to clarify the situation when handling open journal files, regardless of journal mode. check-in: 1c318ef3 user: mistachkin tags: trunk
02:29
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. check-in: fdc651e2 user: mistachkin tags: trunk
2014-03-06
18:16
Do not run corruptH.test in mmap mode. check-in: c0d54b4e user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/pager.c.

  4885   4885       ** in fact there is none.  This results in a false-positive which will
  4886   4886       ** be dealt with by the playback routine.  Ticket #3883.
  4887   4887       */
  4888   4888       rc = sqlite3OsCheckReservedLock(pPager->fd, &locked);
  4889   4889       if( rc==SQLITE_OK && !locked ){
  4890   4890         Pgno nPage;                 /* Number of pages in database file */
  4891   4891   
  4892         -      /* Check the size of the database file. If it consists of 0 pages,
  4893         -      ** then delete the journal file. See the header comment above for 
  4894         -      ** the reasoning here.  Delete the obsolete journal file under
  4895         -      ** a RESERVED lock to avoid race conditions and to avoid violating
  4896         -      ** [H33020].
         4892  +      /* Check the size of the database file. If it consists of 0 pages
         4893  +      ** and the journal is not being persisted, then delete the journal
         4894  +      ** file.  See the header comment above for the reasoning here.
         4895  +      ** Delete the obsolete journal file under a RESERVED lock to avoid
         4896  +      ** race conditions and to avoid violating [H33020].
  4897   4897         */
  4898   4898         rc = pagerPagecount(pPager, &nPage);
  4899   4899         if( rc==SQLITE_OK ){
  4900         -        if( nPage==0 ){
         4900  +        if( nPage==0 && pPager->journalMode!=PAGER_JOURNALMODE_PERSIST ){
  4901   4901             sqlite3BeginBenignMalloc();
  4902   4902             if( pagerLockDb(pPager, RESERVED_LOCK)==SQLITE_OK ){
  4903   4903               sqlite3OsDelete(pVfs, pPager->zJournal, 0);
  4904   4904               if( !pPager->exclusiveMode ) pagerUnlockDb(pPager, SHARED_LOCK);
  4905   4905             }
  4906   4906             sqlite3EndBenignMalloc();
  4907   4907           }else{

Changes to test/uri.test.

   234    234   #
   235    235   ifcapable wal {
   236    236     testvfs tvfs1 
   237    237     tvfs1 filter {xOpen xDelete xAccess xFullPathname}
   238    238     tvfs1 script tvfs1_callback
   239    239     proc tvfs1_callback {method filename args} { 
   240    240       set ::T1([file tail $filename]) 1 
          241  +    return SQLITE_OK
   241    242     }
   242    243     testvfs tvfs2 
   243    244     tvfs2 filter {xOpen xDelete xAccess xFullPathname}
   244    245     tvfs2 script tvfs2_callback
   245    246     proc tvfs2_callback {method filename args} { 
   246    247       set ::T2([file tail $filename]) 1 
          248  +    return SQLITE_OK
   247    249     }
   248    250     
   249    251     catch {db close}
   250    252     eval forcedelete [glob test.db*]
   251    253     do_test 5.1.1 {
   252    254       sqlite3 db file:test.db1?vfs=tvfs1
   253    255       execsql {