/ Check-in [60b9f5e4]
Login

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

Overview
Comment:Improve a comment in wal.c. No code changes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | experimental-mmap
Files: files | file ages | folders
SHA1:60b9f5e4dd2af54975ba78437239f0bebd472fd2
User & Date: dan 2013-03-23 17:29:06
Context
2013-03-23
21:00
Replace the sqlite3_io_methods.xMremap interface with sqlite3_io_methods.xFetch and xUnfetch. check-in: 1431be95 user: dan tags: experimental-mmap
17:29
Improve a comment in wal.c. No code changes. check-in: 60b9f5e4 user: dan tags: experimental-mmap
14:20
Fix a case where a checkpoint operation could write to an invalid part of a memory mapped region. check-in: 8dbe89d0 user: dan tags: experimental-mmap
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/wal.c.

1721
1722
1723
1724
1725
1726
1727
1728
1729

1730




1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
    u32 nBackfill = pInfo->nBackfill;

    /* Sync the WAL to disk */
    if( sync_flags ){
      rc = sqlite3OsSync(pWal->pWalFd, sync_flags);
    }

    /* If the database file may grow as a result of this checkpoint, hint
    ** about the eventual size of the db file to the VFS layer. 

    */




    if( rc==SQLITE_OK ){
      i64 nReq = ((i64)mxPage * szPage);
      rc = sqlite3PagerSetFilesize(pWal->pPager, nReq); 
    }

    /* Iterate through the contents of the WAL, copying data to the db file. */
    while( rc==SQLITE_OK && 0==walIteratorNext(pIter, &iDbpage, &iFrame) ){
      i64 iOffset;
      assert( walFramePgno(pWal, iFrame)==iDbpage );
      if( iFrame<=nBackfill || iFrame>mxSafeFrame || iDbpage>mxPage ) continue;







|
|
>
|
>
>
>
>


|







1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
    u32 nBackfill = pInfo->nBackfill;

    /* Sync the WAL to disk */
    if( sync_flags ){
      rc = sqlite3OsSync(pWal->pWalFd, sync_flags);
    }

    /* If the database file is currently smaller than mxPage pages in size,
    ** the call below issues an SQLITE_FCNTL_SIZE_HINT to the OS layer to
    ** inform it that it is likely to grow to that size.
    **
    ** Additionally, if the pager is using mmap(), then the call to 
    ** SetFilesize() guarantees that the mapping is not larger than mxPage
    ** pages. This makes the sqlite3OsTruncate() call below safe - no pages
    ** that are part of the mapped region will be truncated away.  */
    if( rc==SQLITE_OK ){
      i64 nReq = ((i64)mxPage * szPage);
      rc = sqlite3PagerSetFilesize(pWal->pPager, nReq);
    }

    /* Iterate through the contents of the WAL, copying data to the db file. */
    while( rc==SQLITE_OK && 0==walIteratorNext(pIter, &iDbpage, &iFrame) ){
      i64 iOffset;
      assert( walFramePgno(pWal, iFrame)==iDbpage );
      if( iFrame<=nBackfill || iFrame>mxSafeFrame || iDbpage>mxPage ) continue;