SQLite

Check-in [355c594e82]
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
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.846
Context
2017-08-07
14:15
Update this branch with latest trunk changes. (check-in: 17bc7ded07 user: dan tags: server-process-edition)
14:06
Fix a bug on this branch involving mmap mode and readonly transactions. (check-in: 355c594e82 user: dan tags: server-process-edition)
2017-07-31
19:55
Add documentation file ./README-server-edition.html. (check-in: fbc4f4ad25 user: dan tags: server-process-edition)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to src/pager.c.
1048
1049
1050
1051
1052
1053
1054



1055
1056
1057
1058
1059
1060
1061
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064







+
+
+







** content from the pager.
*/
static void setGetterMethod(Pager *pPager){
  if( pPager->errCode ){
    pPager->xGet = getPageError;
#if SQLITE_MAX_MMAP_SIZE>0
  }else if( USEFETCH(pPager)
#ifdef SQLITE_SERVER_EDITION
   && sqlite3ServerIsReadonly(pPager->pServer)==0
#endif
#ifdef SQLITE_HAS_CODEC
   && pPager->xCodec==0
#endif
  ){
    pPager->xGet = getPageMMap;
#endif /* SQLITE_MAX_MMAP_SIZE>0 */
  }else{
5449
5450
5451
5452
5453
5454
5455

5456
5457
5458
5459
5460
5461
5462
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466







+







    assert( sqlite3PagerRefcount(pPager)==0 );
    assert( pagerUseWal(pPager)==0 );
    pager_reset(pPager);
    rc = sqlite3ServerBegin(pPager->pServer, bReadonly);
    if( rc==SQLITE_OK ){
      rc = sqlite3ServerLock(pPager->pServer, 1, 0, 0);
    }
    setGetterMethod(pPager);
  }
#endif
  if( rc==SQLITE_OK && pagerUseWal(pPager) ){
    assert( rc==SQLITE_OK );
    rc = pagerBeginReadTransaction(pPager);
  }

Changes to src/server.c.
686
687
688
689
690
691
692










693
694
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704







+
+
+
+
+
+
+
+
+
+


    pRet = pDb->pFree;
    pDb->pFree = pRet->pNext;
    pRet->pNext = 0;
  }
  sqlite3_mutex_leave(pDb->mutex);
  return pRet;
}

/*
** Return true if the handle passed as the only argument is not NULL and
** currently has an open readonly transaction (one started with BEGIN
** READONLY). Return false if the argument is NULL, if there is no open
** transaction, or if the open transaction is read/write.
*/
int sqlite3ServerIsReadonly(Server *p){
  return (p && p->eTrans==SERVER_TRANS_READONLY);
}

#endif /* ifdef SQLITE_SERVER_EDITION */
Changes to src/server.h.
43
44
45
46
47
48
49

50
51
52
53
54
55
43
44
45
46
47
48
49
50
51
52
53
54
55
56







+






int sqlite3ServerLock(Server *p, Pgno pgno, int bWrite, int bBlock);

int sqlite3ServerHasLock(Server *p, Pgno pgno, int bWrite);

ServerPage *sqlite3ServerBuffer(Server*);

/* For "BEGIN READONLY" clients. */
int sqlite3ServerIsReadonly(Server*);
void sqlite3ServerReadPage(Server*, Pgno, u8**);
void sqlite3ServerEndReadPage(Server*, Pgno);

#endif /* SQLITE_SERVER_H */
#endif /* SQLITE_SERVER_EDITION */