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:
10
src/wal.c
10
src/wal.c
@@ -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, ¬Used);
|
||||
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);
|
||||
|
Reference in New Issue
Block a user