1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

In lsm, attempt to unmap the database file before truncating it when

disconnecting. A mapped file may not be truncated on win32.

FossilOrigin-Name: 39069941e98605bc8c7c736819781761760ee2b83363471ceb6f19e5eb06b13a
This commit is contained in:
dan
2017-07-11 20:36:35 +00:00
parent 416b8694fa
commit 1cd523cf0f
5 changed files with 24 additions and 9 deletions

View File

@ -312,6 +312,7 @@ static void doDbDisconnect(lsm_db *pDb){
/* The database may only be truncated if there exist no read-only
** clients - either connected or running rotrans transactions. */
if( bReadonly==0 && bRotrans==0 ){
lsmFsUnmap(pDb->pFS);
dbTruncateFile(pDb);
if( p->pFile && p->bMultiProc ){
lsmEnvShmUnmap(pDb->pEnv, p->pFile, 1);
@ -568,6 +569,7 @@ void lsmDbDatabaseRelease(lsm_db *pDb){
doDbDisconnect(pDb);
}
lsmFsUnmap(pDb->pFS);
lsmMutexEnter(pDb->pEnv, p->pClientMutex);
for(ppDb=&p->pConn; *ppDb!=pDb; ppDb=&((*ppDb)->pNext));
*ppDb = pDb->pNext;