/ Changes On Branch missing-journal-file
Login

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

Changes In Branch missing-journal-file Excluding Merge-Ins

This is equivalent to a diff from 8a4314a398 to 96f04d99f3

2013-04-09
19:19
Check in the instrumented code for the mptest test case that appears to show a spontaneously disappearing journal file. (Closed-Leaf check-in: 96f04d99f3 user: dan tags: missing-journal-file)
16:19
Add extra #ifndef statements in os_unix.c and os_win.c to make sure the memory mapped I/O really is disabled when SQLITE_DISABLE_MMAP is set. (check-in: c1e2523c90 user: drh tags: trunk)
2013-04-08
20:47
Disable the use of memory-mapped I/O if the SQLITE_DISABLE_MMAP macro is defined. Automatically define this macro for OpenBSD and QNX. Other systems are likely to be added to the disabled list over time. (check-in: 8a4314a398 user: drh tags: trunk)
19:13
In mptester, handle startScript no-change commits using a retry rather than grabbing an exclusive transaction. (check-in: ae8bb24bfb user: drh tags: trunk)

Changes to mptest/config02.test.

1
2
3
4
5
6
7
8
9

10
11
12

13
14
15

16
17
18
19
20
21
22
1
2
3
4
5
6
7
8

9
10
11

12
13
14

15
16
17
18
19
20
21
22








-
+


-
+


-
+







/*
** Configure five tasks in different ways, then run tests.
*/
PRAGMA page_size=512;
--task 1
  PRAGMA mmap_limit=0;
--end
--task 2
  PRAGMA mmap_limit=28672;
  PRAGMA mmap_limit=0;
--end
--task 3
  PRAGMA mmap_limit=8192;
  PRAGMA mmap_limit=0;
--end
--task 4
  PRAGMA mmap_limit=65536;
  PRAGMA mmap_limit=0;
--end
--source multiwrite01.test
--source crash02.subtest
PRAGMA page_size=1024;
VACUUM;
CREATE TABLE pgsz(taskid, sz INTEGER);
--task 1

Changes to src/os_unix.c.

1874
1875
1876
1877
1878
1879
1880


1881
1882
1883
1884
1885
1886
1887
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889







+
+







** Close a file.
*/
static int unixClose(sqlite3_file *id){
  int rc = SQLITE_OK;
  unixFile *pFile = (unixFile *)id;
  unixUnlock(id, NO_LOCK);
  unixEnterMutex();

access(pFile->zPath, F_OK);

  /* unixFile.pInode is always valid here. Otherwise, a different close
  ** routine (e.g. nolockClose()) would be called instead.
  */
  assert( pFile->pInode->nLock>0 || pFile->pInode->bProcessLock==0 );
  if( ALWAYS(pFile->pInode) && pFile->pInode->nLock ){
    /* If there are outstanding locks, do not actually close the file just
3209
3210
3211
3212
3213
3214
3215


3216
3217
3218
3219
3220
3221
3222
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226







+
+







  ** file), the bytes in the locking range should never be read or written. */
#if 0
  assert( pFile->pUnused==0
       || offset>=PENDING_BYTE+512
       || offset+amt<=PENDING_BYTE 
  );
#endif

access(pFile->zPath, F_OK);

#ifdef SQLITE_DEBUG
  /* If we are doing a normal write to a database file (as opposed to
  ** doing a hot-journal rollback or a write to some file other than a
  ** normal database file) then record the fact that the database
  ** has changed.  If the transaction counter is modified, record that
  ** fact too.
5570
5571
5572
5573
5574
5575
5576

5577
5578
5579
5580
5581
5582
5583
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588







+







    rc = findCreateFileMode(zName, flags, &openMode, &uid, &gid);
    if( rc!=SQLITE_OK ){
      assert( !p->pUnused );
      assert( eType==SQLITE_OPEN_WAL || eType==SQLITE_OPEN_MAIN_JOURNAL );
      return rc;
    }
    fd = robust_open(zName, openFlags, openMode);
    access(zName, F_OK);
    OSTRACE(("OPENX   %-3d %s 0%o\n", fd, zName, openFlags));
    if( fd<0 && errno!=EISDIR && isReadWrite && !isExclusive ){
      /* Failed to open the file for read/write access. Try read-only. */
      flags &= ~(SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE);
      openFlags &= ~(O_RDWR|O_CREAT);
      flags |= SQLITE_OPEN_READONLY;
      openFlags |= O_RDONLY;
5705
5706
5707
5708
5709
5710
5711

5712
5713
5714
5715
5716
5717
5718
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724







+







  sqlite3_vfs *NotUsed,     /* VFS containing this as the xDelete method */
  const char *zPath,        /* Name of file to be deleted */
  int dirSync               /* If true, fsync() directory after deleting file */
){
  int rc = SQLITE_OK;
  UNUSED_PARAMETER(NotUsed);
  SimulateIOError(return SQLITE_IOERR_DELETE);
  access(zPath, F_OK);
  if( osUnlink(zPath)==(-1) ){
    if( errno==ENOENT ){
      rc = SQLITE_IOERR_DELETE_NOENT;
    }else{
      rc = unixLogError(SQLITE_IOERR_DELETE, "unlink", zPath);
    }
    return rc;

Changes to src/pager.c.

1962
1963
1964
1965
1966
1967
1968

1969
1970
1971
1972
1973
1974
1975
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976







+







      assert( pPager->journalMode==PAGER_JOURNALMODE_DELETE 
           || pPager->journalMode==PAGER_JOURNALMODE_MEMORY 
           || pPager->journalMode==PAGER_JOURNALMODE_WAL 
      );
      sqlite3OsClose(pPager->jfd);
      if( bDelete ){
        rc = sqlite3OsDelete(pPager->pVfs, pPager->zJournal, 0);
assert( rc!=SQLITE_IOERR_DELETE_NOENT );
      }
    }
  }

#ifdef SQLITE_CHECK_PAGES
  sqlite3PcacheIterateDirty(pPager->pPCache, pager_set_pagehash);
  if( pPager->dbSize==0 && sqlite3PcacheRefCount(pPager->pPCache)>0 ){
2469
2470
2471
2472
2473
2474
2475

2476
2477
2478
2479
2480
2481
2482
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484







+







      }
    }
    zJournal += (sqlite3Strlen30(zJournal)+1);
  }
 
  sqlite3OsClose(pMaster);
  rc = sqlite3OsDelete(pVfs, zMaster, 0);
assert( rc!=SQLITE_IOERR_DELETE_NOENT );

delmaster_out:
  sqlite3_free(zMasterJournal);
  if( pMaster ){
    sqlite3OsClose(pMaster);
    assert( !isOpen(pJournal) );
    sqlite3_free(pMaster);

Changes to src/vdbeaux.c.

1927
1928
1929
1930
1931
1932
1933

1934
1935
1936
1937
1938
1939
1940
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941







+







    }

    /* Delete the master journal file. This commits the transaction. After
    ** doing this the directory is synced again before any individual
    ** transaction files are deleted.
    */
    rc = sqlite3OsDelete(pVfs, zMaster, 1);
assert( rc!=SQLITE_IOERR_DELETE_NOENT );
    sqlite3DbFree(db, zMaster);
    zMaster = 0;
    if( rc ){
      return rc;
    }

    /* All files and directories have already been synced, so the following