/ Check-in [5b082efe]
Login

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

Overview
Comment:Remove the restriction on using xFetch to load the root pages of tables and indexes. It appears to have been based on a misconception.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | experimental-mmap
Files: files | file ages | folders
SHA1: 5b082efead488a2fccc18171e640e0aa5252d1d0
User & Date: dan 2013-04-03 11:52:16
Context
2013-04-03
13:09
Change the mmap_limit pragma to report the new limit, or to report the existing limit if called with no arguments. Report the default mmap_limit as part of PRAGMA compile_options. Set the default mmmap_limit to 0 for all systems other than linux, mac, windows, and solaris. check-in: 2d9f1327 user: drh tags: experimental-mmap
11:52
Remove the restriction on using xFetch to load the root pages of tables and indexes. It appears to have been based on a misconception. check-in: 5b082efe user: dan tags: experimental-mmap
11:38
When moving a page to make way for the root page of a new table or index in an auto-vacuum database, save the positions of any cursors that may be holding xFetch references to the page being moved. check-in: 9d9b1da5 user: dan tags: experimental-mmap
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/btree.c.

  2579   2579     sqlite3BtreeEnter(p);
  2580   2580     p->pBt->nPage = 0;
  2581   2581     rc = newDatabase(p->pBt);
  2582   2582     sqlite3BtreeLeave(p);
  2583   2583     return rc;
  2584   2584   }
  2585   2585   
  2586         -/*
  2587         -** Ensure that any root page references held by open cursors are not
  2588         -** mmap pages.
  2589         -*/
  2590         -static int btreeSwapOutMmap(BtShared *pBt){
  2591         -  int rc = SQLITE_OK;             /* Return code */
  2592         -  BtCursor *pCsr;                 /* Used to iterate through all open cursors */
  2593         -
  2594         -  for(pCsr=pBt->pCursor; pCsr && rc==SQLITE_OK; pCsr=pCsr->pNext){
  2595         -    if( pCsr->iPage>=0 ){
  2596         -      MemPage *pPg = pCsr->apPage[0];
  2597         -      if( pPg && pPg->pDbPage->flags & PGHDR_MMAP ){
  2598         -        MemPage *pNew = 0;
  2599         -        rc = getAndInitPage(pBt, pPg->pgno, &pNew, 0);
  2600         -        if( rc==SQLITE_OK ){
  2601         -          if( pCsr->iPage==0 ){
  2602         -            pCsr->info.pCell = pNew->aData + (pCsr->info.pCell - pPg->aData);
  2603         -          }
  2604         -          pCsr->apPage[0] = pNew;
  2605         -          releasePage(pPg);
  2606         -        }
  2607         -      }
  2608         -    }
  2609         -  }
  2610         -
  2611         -  return rc;
  2612         -}
  2613         -
  2614   2586   /*
  2615   2587   ** Attempt to start a new transaction. A write-transaction
  2616   2588   ** is started if the second argument is nonzero, otherwise a read-
  2617   2589   ** transaction.  If the second argument is 2 or more and exclusive
  2618   2590   ** transaction is started, meaning that no other process is allowed
  2619   2591   ** to access the database.  A preexisting transaction may not be
  2620   2592   ** upgraded to exclusive by calling this routine a second time - the
................................................................................
  2713   2685       while( pBt->pPage1==0 && SQLITE_OK==(rc = lockBtree(pBt)) );
  2714   2686   
  2715   2687       if( rc==SQLITE_OK && wrflag ){
  2716   2688         if( (pBt->btsFlags & BTS_READ_ONLY)!=0 ){
  2717   2689           rc = SQLITE_READONLY;
  2718   2690         }else{
  2719   2691           rc = sqlite3PagerBegin(pBt->pPager,wrflag>1,sqlite3TempInMemory(p->db));
  2720         -        if( rc==SQLITE_OK ){
  2721         -          rc = btreeSwapOutMmap(pBt);
  2722         -        }
  2723   2692           if( rc==SQLITE_OK ){
  2724   2693             rc = newDatabase(pBt);
  2725   2694           }
  2726   2695         }
  2727   2696       }
  2728   2697     
  2729   2698       if( rc!=SQLITE_OK ){
................................................................................
  4415   4384         releasePage(pCur->apPage[i]);
  4416   4385       }
  4417   4386       pCur->iPage = 0;
  4418   4387     }else if( pCur->pgnoRoot==0 ){
  4419   4388       pCur->eState = CURSOR_INVALID;
  4420   4389       return SQLITE_OK;
  4421   4390     }else{
  4422         -    rc = getAndInitPage(pBt, pCur->pgnoRoot, &pCur->apPage[0], 0);
         4391  +    rc = getAndInitPage(pBt, pCur->pgnoRoot, &pCur->apPage[0], pCur->wrFlag==0);
  4423   4392       if( rc!=SQLITE_OK ){
  4424   4393         pCur->eState = CURSOR_INVALID;
  4425   4394         return rc;
  4426   4395       }
  4427   4396       pCur->iPage = 0;
  4428   4397   
  4429   4398       /* If pCur->pKeyInfo is not NULL, then the caller that opened this cursor