/ Check-in [0e7aa622]
Login

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

Overview
Comment:Remove the unused mmapSizeActual field from the Windows sqlite3_file implementation.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 0e7aa62227d1d9c3540b54d7caf44a1ce7ccfa706672fc41dbb2be477ab3a667
User & Date: drh 2018-11-24 16:07:21
Context
2018-11-24
17:46
Make the winTruncate() method of the windows VFS be a no-op if there are outstanding references to the memory-mapped pages. Otherwise, memory might be deleted out from under those references when the file is remapped during the truncate operation. check-in: ffce4aac user: drh tags: trunk
16:07
Remove the unused mmapSizeActual field from the Windows sqlite3_file implementation. check-in: 0e7aa622 user: drh tags: trunk
2018-11-22
19:10
Fix a problem reading from temp databases in SQLITE_DIRECT_OVERFLOW_READ builds. check-in: 81629ba9 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_win.c.

   280    280     winceLock local;        /* Locks obtained by this instance of winFile */
   281    281     winceLock *shared;      /* Global shared lock memory for the file  */
   282    282   #endif
   283    283   #if SQLITE_MAX_MMAP_SIZE>0
   284    284     int nFetchOut;                /* Number of outstanding xFetch references */
   285    285     HANDLE hMap;                  /* Handle for accessing memory mapping */
   286    286     void *pMapRegion;             /* Area memory mapped */
   287         -  sqlite3_int64 mmapSize;       /* Usable size of mapped region */
   288         -  sqlite3_int64 mmapSizeActual; /* Actual size of mapped region */
          287  +  sqlite3_int64 mmapSize;       /* Size of mapped region */
   289    288     sqlite3_int64 mmapSizeMax;    /* Configured FCNTL_MMAP_SIZE value */
   290    289   #endif
   291    290   };
   292    291   
   293    292   /*
   294    293   ** The winVfsAppData structure is used for the pAppData member for all of the
   295    294   ** Win32 VFS variants.
................................................................................
  4330   4329   /*
  4331   4330   ** Cleans up the mapped region of the specified file, if any.
  4332   4331   */
  4333   4332   #if SQLITE_MAX_MMAP_SIZE>0
  4334   4333   static int winUnmapfile(winFile *pFile){
  4335   4334     assert( pFile!=0 );
  4336   4335     OSTRACE(("UNMAP-FILE pid=%lu, pFile=%p, hMap=%p, pMapRegion=%p, "
  4337         -           "mmapSize=%lld, mmapSizeActual=%lld, mmapSizeMax=%lld\n",
         4336  +           "mmapSize=%lld, mmapSizeMax=%lld\n",
  4338   4337              osGetCurrentProcessId(), pFile, pFile->hMap, pFile->pMapRegion,
  4339         -           pFile->mmapSize, pFile->mmapSizeActual, pFile->mmapSizeMax));
         4338  +           pFile->mmapSize, pFile->mmapSizeMax));
  4340   4339     if( pFile->pMapRegion ){
  4341   4340       if( !osUnmapViewOfFile(pFile->pMapRegion) ){
  4342   4341         pFile->lastErrno = osGetLastError();
  4343   4342         OSTRACE(("UNMAP-FILE pid=%lu, pFile=%p, pMapRegion=%p, "
  4344   4343                  "rc=SQLITE_IOERR_MMAP\n", osGetCurrentProcessId(), pFile,
  4345   4344                  pFile->pMapRegion));
  4346   4345         return winLogError(SQLITE_IOERR_MMAP, pFile->lastErrno,
  4347   4346                            "winUnmapfile1", pFile->zPath);
  4348   4347       }
  4349   4348       pFile->pMapRegion = 0;
  4350   4349       pFile->mmapSize = 0;
  4351         -    pFile->mmapSizeActual = 0;
  4352   4350     }
  4353   4351     if( pFile->hMap!=NULL ){
  4354   4352       if( !osCloseHandle(pFile->hMap) ){
  4355   4353         pFile->lastErrno = osGetLastError();
  4356   4354         OSTRACE(("UNMAP-FILE pid=%lu, pFile=%p, hMap=%p, rc=SQLITE_IOERR_MMAP\n",
  4357   4355                  osGetCurrentProcessId(), pFile, pFile->hMap));
  4358   4356         return winLogError(SQLITE_IOERR_MMAP, pFile->lastErrno,
................................................................................
  4455   4453         /* Log the error, but continue normal operation using xRead/xWrite */
  4456   4454         OSTRACE(("MAP-FILE-MAP pid=%lu, pFile=%p, rc=%s\n",
  4457   4455                  osGetCurrentProcessId(), pFd, sqlite3ErrName(rc)));
  4458   4456         return SQLITE_OK;
  4459   4457       }
  4460   4458       pFd->pMapRegion = pNew;
  4461   4459       pFd->mmapSize = nMap;
  4462         -    pFd->mmapSizeActual = nMap;
  4463   4460     }
  4464   4461   
  4465   4462     OSTRACE(("MAP-FILE pid=%lu, pFile=%p, rc=SQLITE_OK\n",
  4466   4463              osGetCurrentProcessId(), pFd));
  4467   4464     return SQLITE_OK;
  4468   4465   }
  4469   4466   #endif /* SQLITE_MAX_MMAP_SIZE>0 */
................................................................................
  5257   5254     }
  5258   5255     pFile->lastErrno = NO_ERROR;
  5259   5256     pFile->zPath = zName;
  5260   5257   #if SQLITE_MAX_MMAP_SIZE>0
  5261   5258     pFile->hMap = NULL;
  5262   5259     pFile->pMapRegion = 0;
  5263   5260     pFile->mmapSize = 0;
  5264         -  pFile->mmapSizeActual = 0;
  5265   5261     pFile->mmapSizeMax = sqlite3GlobalConfig.szMmap;
  5266   5262   #endif
  5267   5263   
  5268   5264     OpenCounter(+1);
  5269   5265     return rc;
  5270   5266   }
  5271   5267