SQLite

Check-in [3a82c8e6cb]
Login

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

Overview
Comment:Within a write-transaction on a wal database in mmap mode, check the page-cache for an entry before the wal file. This can be faster if the wal file is very large.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | mmap-wal-bigtrans
Files: files | file ages | folders
SHA1: 3a82c8e6cb7227fe05e304c9550d0398404e0938
User & Date: dan 2015-08-07 09:42:12.553
Context
2015-08-07
09:42
Within a write-transaction on a wal database in mmap mode, check the page-cache for an entry before the wal file. This can be faster if the wal file is very large. (Leaf check-in: 3a82c8e6cb user: dan tags: mmap-wal-bigtrans)
2015-08-06
12:54
increase the version number to 3.8.12 (check-in: e596a6b63f user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/pager.c.
5270
5271
5272
5273
5274
5275
5276
5277





5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297

5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
  pPager->hasBeenUsed = 1;

  /* If the pager is in the error state, return an error immediately. 
  ** Otherwise, request the page from the PCache layer. */
  if( pPager->errCode!=SQLITE_OK ){
    rc = pPager->errCode;
  }else{
    if( bMmapOk && pagerUseWal(pPager) ){





      rc = sqlite3WalFindFrame(pPager->pWal, pgno, &iFrame);
      if( rc!=SQLITE_OK ) goto pager_acquire_err;
    }

    if( bMmapOk && iFrame==0 ){
      void *pData = 0;

      rc = sqlite3OsFetch(pPager->fd, 
          (i64)(pgno-1) * pPager->pageSize, pPager->pageSize, &pData
      );

      if( rc==SQLITE_OK && pData ){
        if( pPager->eState>PAGER_READER ){
          pPg = sqlite3PagerLookup(pPager, pgno);
        }
        if( pPg==0 ){
          rc = pagerAcquireMapPage(pPager, pgno, pData, &pPg);
        }else{
          sqlite3OsUnfetch(pPager->fd, (i64)(pgno-1)*pPager->pageSize, pData);
        }

        if( pPg ){
          assert( rc==SQLITE_OK );
          *ppPage = pPg;
          return SQLITE_OK;
        }
      }
      if( rc!=SQLITE_OK ){
        goto pager_acquire_err;
      }
    }

    {
      sqlite3_pcache_page *pBase;







|
>
>
>
>
>
|
|
|

|
|
<
|
|
|
<
|
<
|

<
<
<
<
|
>
|
|
|
|
|
|







5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288

5289
5290
5291

5292

5293
5294




5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
  pPager->hasBeenUsed = 1;

  /* If the pager is in the error state, return an error immediately. 
  ** Otherwise, request the page from the PCache layer. */
  if( pPager->errCode!=SQLITE_OK ){
    rc = pPager->errCode;
  }else{
    if( bMmapOk ){
      if( pPager->eState>PAGER_READER ){
        pPg = sqlite3PagerLookup(pPager, pgno);
      }

      if( pPg==0 && pagerUseWal(pPager) ){
        rc = sqlite3WalFindFrame(pPager->pWal, pgno, &iFrame);
        if( rc!=SQLITE_OK ) goto pager_acquire_err;
      }

      if( pPg==0 && iFrame==0 ){
        void *pData = 0;

        rc = sqlite3OsFetch(pPager->fd, 
            (i64)(pgno-1) * pPager->pageSize, pPager->pageSize, &pData
        );

        if( rc==SQLITE_OK && pData ){

          rc = pagerAcquireMapPage(pPager, pgno, pData, &pPg);
        }




      }

      if( pPg ){
        assert( rc==SQLITE_OK );
        *ppPage = pPg;
        return SQLITE_OK;
      }

      if( rc!=SQLITE_OK ){
        goto pager_acquire_err;
      }
    }

    {
      sqlite3_pcache_page *pBase;