SQLite

Check-in [b6157267f9]
Login

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

Overview
Comment:Fix a bug causing readonly mvcc connections to read the wrong cache entry in some cases.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | server-process-edition
Files: files | file ages | folders
SHA3-256: b6157267f9d4ecdffbdf4b1e591b8d6baaaa964c418ec247a24ccb82146f9041
User & Date: dan 2017-07-11 16:47:26.878
Context
2017-07-11
18:38
Add SQL function usleep() to test program tserver.c. (check-in: 8cbe8f2b2f user: dan tags: server-process-edition)
16:47
Fix a bug causing readonly mvcc connections to read the wrong cache entry in some cases. (check-in: b6157267f9 user: dan tags: server-process-edition)
2017-07-08
20:46
Support read-only MVCC transactions in server-mode. Started using "BEGIN READONLY". (check-in: 5a043aa8dd user: dan tags: server-process-edition)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/server.c.
638
639
640
641
642
643
644

645
646
647
648
649
650
651
652
    int iHash = pgno % HMA_HASH_SIZE;

    sqlite3_mutex_enter(pDb->mutex);

    /* Search the hash table for the oldest version of page pgno with
    ** a commit-id greater than or equal to Server.iCommitId.  */
    for(pIter=pDb->apPg[iHash]; pIter; pIter=pIter->pHashNext){

      if( pIter->iCommitId>=p->iCommitId 
       && (pBest==0 || pIter->iCommitId<pBest->iCommitId) 
      ){
        pBest = pIter;
      }
    }

    if( pBest ){







>
|







638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
    int iHash = pgno % HMA_HASH_SIZE;

    sqlite3_mutex_enter(pDb->mutex);

    /* Search the hash table for the oldest version of page pgno with
    ** a commit-id greater than or equal to Server.iCommitId.  */
    for(pIter=pDb->apPg[iHash]; pIter; pIter=pIter->pHashNext){
      if( pIter->pgno==pgno 
       && pIter->iCommitId>=p->iCommitId 
       && (pBest==0 || pIter->iCommitId<pBest->iCommitId) 
      ){
        pBest = pIter;
      }
    }

    if( pBest ){