/ Check-in [3a82c8e6]
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 | SQL archive
Timelines: family | ancestors | mmap-wal-bigtrans
Files: files | file ages | folders
SHA1: 3a82c8e6cb7227fe05e304c9550d0398404e0938
User & Date: dan 2015-08-07 09:42:12
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: 3a82c8e6 user: dan tags: mmap-wal-bigtrans
2015-08-06
12:54
increase the version number to 3.8.12 check-in: e596a6b6 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/pager.c.

  5270   5270     pPager->hasBeenUsed = 1;
  5271   5271   
  5272   5272     /* If the pager is in the error state, return an error immediately. 
  5273   5273     ** Otherwise, request the page from the PCache layer. */
  5274   5274     if( pPager->errCode!=SQLITE_OK ){
  5275   5275       rc = pPager->errCode;
  5276   5276     }else{
  5277         -    if( bMmapOk && pagerUseWal(pPager) ){
  5278         -      rc = sqlite3WalFindFrame(pPager->pWal, pgno, &iFrame);
  5279         -      if( rc!=SQLITE_OK ) goto pager_acquire_err;
  5280         -    }
         5277  +    if( bMmapOk ){
         5278  +      if( pPager->eState>PAGER_READER ){
         5279  +        pPg = sqlite3PagerLookup(pPager, pgno);
         5280  +      }
  5281   5281   
  5282         -    if( bMmapOk && iFrame==0 ){
  5283         -      void *pData = 0;
         5282  +      if( pPg==0 && pagerUseWal(pPager) ){
         5283  +        rc = sqlite3WalFindFrame(pPager->pWal, pgno, &iFrame);
         5284  +        if( rc!=SQLITE_OK ) goto pager_acquire_err;
         5285  +      }
  5284   5286   
  5285         -      rc = sqlite3OsFetch(pPager->fd, 
  5286         -          (i64)(pgno-1) * pPager->pageSize, pPager->pageSize, &pData
  5287         -      );
  5288         -
  5289         -      if( rc==SQLITE_OK && pData ){
  5290         -        if( pPager->eState>PAGER_READER ){
  5291         -          pPg = sqlite3PagerLookup(pPager, pgno);
  5292         -        }
  5293         -        if( pPg==0 ){
         5287  +      if( pPg==0 && iFrame==0 ){
         5288  +        void *pData = 0;
         5289  +        rc = sqlite3OsFetch(pPager->fd, 
         5290  +            (i64)(pgno-1) * pPager->pageSize, pPager->pageSize, &pData
         5291  +        );
         5292  +        if( rc==SQLITE_OK && pData ){
  5294   5293             rc = pagerAcquireMapPage(pPager, pgno, pData, &pPg);
  5295         -        }else{
  5296         -          sqlite3OsUnfetch(pPager->fd, (i64)(pgno-1)*pPager->pageSize, pData);
  5297         -        }
  5298         -        if( pPg ){
  5299         -          assert( rc==SQLITE_OK );
  5300         -          *ppPage = pPg;
  5301         -          return SQLITE_OK;
  5302   5294           }
  5303   5295         }
         5296  +
         5297  +      if( pPg ){
         5298  +        assert( rc==SQLITE_OK );
         5299  +        *ppPage = pPg;
         5300  +        return SQLITE_OK;
         5301  +      }
         5302  +
  5304   5303         if( rc!=SQLITE_OK ){
  5305   5304           goto pager_acquire_err;
  5306   5305         }
  5307   5306       }
  5308   5307   
  5309   5308       {
  5310   5309         sqlite3_pcache_page *pBase;