/ Check-in [355c594e]
Login

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

Overview
Comment:Fix a bug on this branch involving mmap mode and readonly transactions.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | server-process-edition
Files: files | file ages | folders
SHA3-256: 355c594e821bb5ad782faf0e8d512305f4e1d7fd60949887a8270beed67d03e3
User & Date: dan 2017-08-07 14:06:01
Context
2017-08-07
14:15
Update this branch with latest trunk changes. check-in: 17bc7ded user: dan tags: server-process-edition
14:06
Fix a bug on this branch involving mmap mode and readonly transactions. check-in: 355c594e user: dan tags: server-process-edition
2017-07-31
19:55
Add documentation file ./README-server-edition.html. check-in: fbc4f4ad user: dan tags: server-process-edition
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/pager.c.

  1048   1048   ** content from the pager.
  1049   1049   */
  1050   1050   static void setGetterMethod(Pager *pPager){
  1051   1051     if( pPager->errCode ){
  1052   1052       pPager->xGet = getPageError;
  1053   1053   #if SQLITE_MAX_MMAP_SIZE>0
  1054   1054     }else if( USEFETCH(pPager)
         1055  +#ifdef SQLITE_SERVER_EDITION
         1056  +   && sqlite3ServerIsReadonly(pPager->pServer)==0
         1057  +#endif
  1055   1058   #ifdef SQLITE_HAS_CODEC
  1056   1059      && pPager->xCodec==0
  1057   1060   #endif
  1058   1061     ){
  1059   1062       pPager->xGet = getPageMMap;
  1060   1063   #endif /* SQLITE_MAX_MMAP_SIZE>0 */
  1061   1064     }else{
................................................................................
  5449   5452       assert( sqlite3PagerRefcount(pPager)==0 );
  5450   5453       assert( pagerUseWal(pPager)==0 );
  5451   5454       pager_reset(pPager);
  5452   5455       rc = sqlite3ServerBegin(pPager->pServer, bReadonly);
  5453   5456       if( rc==SQLITE_OK ){
  5454   5457         rc = sqlite3ServerLock(pPager->pServer, 1, 0, 0);
  5455   5458       }
         5459  +    setGetterMethod(pPager);
  5456   5460     }
  5457   5461   #endif
  5458   5462     if( rc==SQLITE_OK && pagerUseWal(pPager) ){
  5459   5463       assert( rc==SQLITE_OK );
  5460   5464       rc = pagerBeginReadTransaction(pPager);
  5461   5465     }
  5462   5466   

Changes to src/server.c.

   686    686       pRet = pDb->pFree;
   687    687       pDb->pFree = pRet->pNext;
   688    688       pRet->pNext = 0;
   689    689     }
   690    690     sqlite3_mutex_leave(pDb->mutex);
   691    691     return pRet;
   692    692   }
          693  +
          694  +/*
          695  +** Return true if the handle passed as the only argument is not NULL and
          696  +** currently has an open readonly transaction (one started with BEGIN
          697  +** READONLY). Return false if the argument is NULL, if there is no open
          698  +** transaction, or if the open transaction is read/write.
          699  +*/
          700  +int sqlite3ServerIsReadonly(Server *p){
          701  +  return (p && p->eTrans==SERVER_TRANS_READONLY);
          702  +}
   693    703   
   694    704   #endif /* ifdef SQLITE_SERVER_EDITION */

Changes to src/server.h.

    43     43   int sqlite3ServerLock(Server *p, Pgno pgno, int bWrite, int bBlock);
    44     44   
    45     45   int sqlite3ServerHasLock(Server *p, Pgno pgno, int bWrite);
    46     46   
    47     47   ServerPage *sqlite3ServerBuffer(Server*);
    48     48   
    49     49   /* For "BEGIN READONLY" clients. */
           50  +int sqlite3ServerIsReadonly(Server*);
    50     51   void sqlite3ServerReadPage(Server*, Pgno, u8**);
    51     52   void sqlite3ServerEndReadPage(Server*, Pgno);
    52     53   
    53     54   #endif /* SQLITE_SERVER_H */
    54     55   #endif /* SQLITE_SERVER_EDITION */
    55     56