/ Check-in [32e0bbb7]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Fix a problem when opening a write-transaction while there exist read-only b-tree cursors in mmap mode.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | experimental-mmap
Files: files | file ages | folders
SHA1: 32e0bbb73609ac3ad096a60f1de3095bc79fb0cc
User & Date: dan 2013-03-21 15:57:32
Context
2013-03-21
20:00
Avoid calling xRead() on a part of the database file that is memory mapped. check-in: c8eac290 user: dan tags: experimental-mmap
15:57
Fix a problem when opening a write-transaction while there exist read-only b-tree cursors in mmap mode. check-in: 32e0bbb7 user: dan tags: experimental-mmap
14:47
Do not use the Linux mremap() call. Use the same strategy for xMremap() as on OSX instead. check-in: 5ed8ad78 user: dan tags: experimental-mmap
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/btree.c.

2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
  BtCursor *pCsr;                 /* Used to iterate through all open cursors */

  for(pCsr=pBt->pCursor; pCsr && rc==SQLITE_OK; pCsr=pCsr->pNext){
    if( pCsr->iPage>=0 ){
      MemPage *pPg = pCsr->apPage[0];
      if( pPg->pDbPage->flags & PGHDR_MMAP ){
        MemPage *pNew = 0;
        rc = btreeGetPage(pBt, pPg->pgno, &pNew, 0, 0);
        if( rc==SQLITE_OK && pCsr->iPage==0 ){
          pCsr->info.pCell = pNew->aData + (pCsr->info.pCell - pPg->aData);
        }
        pCsr->apPage[0] = pNew;
        releasePage(pPg);
        if( rc!=SQLITE_OK ) return rc;
      }







|







2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
  BtCursor *pCsr;                 /* Used to iterate through all open cursors */

  for(pCsr=pBt->pCursor; pCsr && rc==SQLITE_OK; pCsr=pCsr->pNext){
    if( pCsr->iPage>=0 ){
      MemPage *pPg = pCsr->apPage[0];
      if( pPg->pDbPage->flags & PGHDR_MMAP ){
        MemPage *pNew = 0;
        rc = getAndInitPage(pBt, pPg->pgno, &pNew, 0);
        if( rc==SQLITE_OK && pCsr->iPage==0 ){
          pCsr->info.pCell = pNew->aData + (pCsr->info.pCell - pPg->aData);
        }
        pCsr->apPage[0] = pNew;
        releasePage(pPg);
        if( rc!=SQLITE_OK ) return rc;
      }