/ Check-in [c8d67aef]
Login

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

Overview
Comment:Fix a case where the mapped part of a database file may be written during a backup operation.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | experimental-mmap
Files: files | file ages | folders
SHA1:c8d67aefff7299dd5c8abeb2a3a52109c0a823ee
User & Date: dan 2013-03-22 19:17:45
Context
2013-03-22
19:56
Fix a potential NULL-pointer dereference in btreeSwapOutMmap(). check-in: e81ccdcd user: drh tags: experimental-mmap
19:17
Fix a case where the mapped part of a database file may be written during a backup operation. check-in: c8d67aef user: dan tags: experimental-mmap
18:20
Allow the database file to be memory mapped in wal mode. check-in: d190ddab user: dan tags: experimental-mmap
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/backup.c.

   516    516               iOff+=pgszSrc
   517    517             ){
   518    518               PgHdr *pSrcPg = 0;
   519    519               const Pgno iSrcPg = (Pgno)((iOff/pgszSrc)+1);
   520    520               rc = sqlite3PagerGet(pSrcPager, iSrcPg, &pSrcPg);
   521    521               if( rc==SQLITE_OK ){
   522    522                 u8 *zData = sqlite3PagerGetData(pSrcPg);
   523         -              rc = sqlite3OsWrite(pFile, zData, pgszSrc, iOff);
          523  +              rc = sqlite3PagerWriteData(pDestPager, zData, pgszSrc, iOff);
   524    524               }
   525    525               sqlite3PagerUnref(pSrcPg);
   526    526             }
   527    527             if( rc==SQLITE_OK ){
   528    528               rc = backupTruncateFile(pFile, iSize);
   529    529             }
   530    530   

Changes to test/permutations.test.

   140    140   
   141    141   test_suite "mmap" -prefix "mm-" -description {
   142    142     Similar to veryquick. Except with memory mapping enabled.
   143    143   } -presql {
   144    144     pragma mmap_size = -65536;
   145    145   } -files [
   146    146     test_set $allquicktests -exclude *malloc* *ioerr* *fault* \
   147         -  multiplex* server1.test shared2.test shared6.test
          147  +  multiplex* server1.test shared2.test shared6.test 
   148    148   ]
   149    149   
   150    150   test_suite "valgrind" -prefix "" -description {
   151    151     Run the "veryquick" test suite with a couple of multi-process tests (that
   152    152     fail under valgrind) omitted.
   153    153   } -files [
   154    154     test_set $allquicktests -exclude *malloc* *ioerr* *fault* wal.test atof1.test

Changes to test/speed1p.test.

    61     61     return $txt
    62     62   }
    63     63   
    64     64   # Create a database schema.
    65     65   #
    66     66   do_test speed1p-1.0 {
    67     67     execsql {
           68  +    PRAGMA mmap_size=65536;
           69  +    PRAGMA journal_mode=wal;
           70  +
    68     71       PRAGMA page_size=1024;
    69     72       PRAGMA cache_size=500;
    70     73       PRAGMA locking_mode=EXCLUSIVE;
    71     74       CREATE TABLE t1(a INTEGER, b INTEGER, c TEXT);
    72     75       CREATE TABLE t2(a INTEGER, b INTEGER, c TEXT);
    73     76       CREATE INDEX i2a ON t2(a);
    74     77       CREATE INDEX i2b ON t2(b);