/ 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 Unified Diffs Show Whitespace Changes Patch

Changes to src/backup.c.

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








|







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

Changes to test/permutations.test.

whitespace changes only

Changes to test/speed1p.test.

61
62
63
64
65
66
67



68
69
70
71
72
73
74
  return $txt
}

# Create a database schema.
#
do_test speed1p-1.0 {
  execsql {



    PRAGMA page_size=1024;
    PRAGMA cache_size=500;
    PRAGMA locking_mode=EXCLUSIVE;
    CREATE TABLE t1(a INTEGER, b INTEGER, c TEXT);
    CREATE TABLE t2(a INTEGER, b INTEGER, c TEXT);
    CREATE INDEX i2a ON t2(a);
    CREATE INDEX i2b ON t2(b);







>
>
>







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
  return $txt
}

# Create a database schema.
#
do_test speed1p-1.0 {
  execsql {
    PRAGMA mmap_size=65536;
    PRAGMA journal_mode=wal;

    PRAGMA page_size=1024;
    PRAGMA cache_size=500;
    PRAGMA locking_mode=EXCLUSIVE;
    CREATE TABLE t1(a INTEGER, b INTEGER, c TEXT);
    CREATE TABLE t2(a INTEGER, b INTEGER, c TEXT);
    CREATE INDEX i2a ON t2(a);
    CREATE INDEX i2b ON t2(b);