1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

When closing a WAL database, if the exclusive lock on the database file is obtained and the database successfully checkpointed, delete the wal-index file from the file system.

FossilOrigin-Name: 2ac5d96c8e5831b392d83c86491d9ed8bc9c8db7
This commit is contained in:
dan
2010-05-05 15:33:05 +00:00
parent 16adb77623
commit 1018e90b1e
3 changed files with 13 additions and 23 deletions

View File

@@ -563,15 +563,15 @@ finished:
}
/*
** Close an open wal-index
** Close an open wal-index.
*/
static void walIndexClose(Wal *pWal){
static void walIndexClose(Wal *pWal, int isDelete){
sqlite3_shm *pWIndex = pWal->pWIndex;
if( pWIndex ){
sqlite3_vfs *pVfs = pWal->pVfs;
int notUsed;
pVfs->xShmLock(pVfs, pWIndex, SQLITE_SHM_UNLOCK, &notUsed);
pVfs->xShmClose(pVfs, pWIndex, 0);
pVfs->xShmClose(pVfs, pWIndex, isDelete);
}
}
@@ -626,7 +626,7 @@ int sqlite3WalOpen(
}
if( rc!=SQLITE_OK ){
walIndexClose(pRet);
walIndexClose(pRet, 0);
sqlite3OsClose(pRet->pFd);
sqlite3_free(pRet);
}else{
@@ -832,7 +832,7 @@ int sqlite3WalClose(
walIndexUnmap(pWal);
}
walIndexClose(pWal);
walIndexClose(pWal, isDelete);
sqlite3OsClose(pWal->pFd);
if( isDelete ){
sqlite3OsDelete(pWal->pVfs, pWal->zName, 0);