SQLite4
Check-in [a92d659eee]
Not logged in

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

Overview
Comment:Fix some problems on this branch.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | mmap-on-demand
Files: files | file ages | folders
SHA1: a92d659eee6a7d91236a91274357fb1194c45c54
User & Date: dan 2013-03-02 16:01:39
Context
2013-03-02
16:01
Fix some problems on this branch. Leaf check-in: a92d659eee user: dan tags: mmap-on-demand
09:15
Merge trunk changes into this branch. check-in: 6666862302 user: dan tags: mmap-on-demand
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/lsm_file.c.

   653    653     int rc = *pRc;
   654    654   
   655    655     assert( iOff>=0 && nByte>0 );
   656    656     assert( p->eUseMmap!=LSM_MMAP_OFF );
   657    657     assert( *ppRef==0 );
   658    658   
   659    659     if( p->eUseMmap==LSM_MMAP_FULL ){
   660         -    fsGrowMapping(pFS, iOff+nByte, &rc);
          660  +    fsGrowMapping(pFS, LSM_MAX(iOff+nByte, 8192), &rc);
   661    661       if( rc==LSM_OK ){
   662    662         pRet = (void *)&((u8 *)p->pMap)[iOff];
   663    663         *ppRef = (MmapMgrRef *)pRet;
   664    664       }
   665    665     }else{
   666    666       MmapMgrRef *pRef = 0;         /* Mapping reference */
   667    667   
................................................................................
   869    869       pFS->nMetasize = 4 * 1024;
   870    870       pFS->pDb = pDb;
   871    871       pFS->pEnv = pDb->pEnv;
   872    872       if( !pDb->compress.xCompress ){
   873    873         pFS->mmapmgr.eUseMmap = pDb->eMmap;
   874    874         pFS->mmapmgr.nMapsz = 1*1024*1024;
   875    875   
   876         -      pFS->mmapmgr.nMapsz = 4*1024;
          876  +      /* pFS->mmapmgr.nMapsz = 4*1024; */
   877    877       }
   878    878   
   879    879       /* Make a copy of the database and log file names. */
   880    880       memcpy(pFS->zDb, zDb, nDb+1);
   881    881       memcpy(pFS->zLog, zDb, nDb);
   882    882       memcpy(&pFS->zLog[nDb], "-log", 5);
   883    883   
................................................................................
   927    927   
   928    928       /* Reset any compression/decompression buffers already allocated */
   929    929       lsmFree(pEnv, pFS->aIBuffer);
   930    930       lsmFree(pEnv, pFS->aOBuffer);
   931    931       pFS->nBuffer = 0;
   932    932   
   933    933       /* Unmap the file, if it is currently mapped */
   934         -    if( pFS->pMap ){
   935         -      lsmEnvRemap(pEnv, pFS->fdDb, -1, &pFS->pMap, &pFS->nMap);
   936         -      pFS->bUseMmap = 0;
   937         -    }
          934  +    fsMmapClose(pFS);
   938    935   
   939    936       /* Free all allocate page structures */
   940    937       pPg = pFS->pLruFirst;
   941    938       while( pPg ){
   942    939         Page *pNext = pPg->pLruNext;
   943    940         if( pPg->flags & PAGE_FREE ) lsmFree(pEnv, pPg->aData);
   944    941         lsmFree(pEnv, pPg);
................................................................................
   950    947       pFS->pLruFirst = 0;
   951    948       pFS->pLruLast = 0;
   952    949       pFS->pFree = 0;
   953    950   
   954    951       /* Configure the FileSystem object */
   955    952       if( db->compress.xCompress ){
   956    953         pFS->pCompress = &db->compress;
   957         -      pFS->bUseMmap = 0;
          954  +      pFS->mmapmgr.eUseMmap = LSM_MMAP_OFF;
   958    955       }else{
   959    956         pFS->pCompress = 0;
   960         -      pFS->bUseMmap = db->bMmap;
          957  +      pFS->mmapmgr.eUseMmap = db->eMmap;
   961    958       }
   962    959     }
   963    960   
   964    961     return LSM_OK;
   965    962   }
   966    963   
   967    964   /*

Changes to src/lsm_main.c.

   325    325         }
   326    326         *piVal = pDb->eSafety;
   327    327         break;
   328    328       }
   329    329   
   330    330       case LSM_CONFIG_MMAP: {
   331    331         int *piVal = va_arg(ap, int *);
   332         -      if( pDb->iReader<0 && *piVal>=0 && *piVal<=1 ){
   333         -        pDb->bMmap = *piVal;
          332  +      if( pDb->iReader<0 && *piVal>=0 && *piVal<=2 ){
          333  +        pDb->eMmap = *piVal;
   334    334           rc = lsmFsConfigure(pDb);
   335    335         }
   336    336         *piVal = pDb->eMmap;
   337    337         break;
   338    338       }
   339    339   
   340    340       case LSM_CONFIG_USE_LOG: {

Changes to src/lsm_sorted.c.

   700    700       ** the left-most most descendent. */
   701    701       if( pCsr->iPg>=0 ){
   702    702         pCsr->aPg[pCsr->iPg].iCell++;
   703    703   
   704    704         iLoad = btreeCursorPtr(aData, nData, pPg->iCell);
   705    705         do {
   706    706           Page *pLoad;
   707         -        pCsr->iPg++;
   708    707           rc = lsmFsDbPageGet(pCsr->pFS, pCsr->pSeg, iLoad, &pLoad);
          708  +        pCsr->iPg++;
   709    709           pCsr->aPg[pCsr->iPg].pPage = pLoad;
   710    710           pCsr->aPg[pCsr->iPg].iCell = 0;
   711    711           if( rc==LSM_OK ){
   712    712             if( pCsr->iPg==(pCsr->nDepth-1) ) break;
   713    713             aData = fsPageData(pLoad, &nData);
   714    714             iLoad = btreeCursorPtr(aData, nData, 0);
   715    715           }