1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Be sure to release all wal-index locks before closing the wal-index.

FossilOrigin-Name: b15b67fa14ff77963f470678ff6188c63be8e079
This commit is contained in:
drh
2010-05-04 17:38:42 +00:00
parent cd058ec4ef
commit a8e654eb38
3 changed files with 25 additions and 12 deletions

View File

@@ -1,8 +1,8 @@
-----BEGIN PGP SIGNED MESSAGE----- -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 Hash: SHA1
C Relax\san\sover-zealous\sassert()\sin\ssqlite3WalUndo(). C Be\ssure\sto\srelease\sall\swal-index\slocks\sbefore\sclosing\sthe\swal-index.
D 2010-05-04T17:20:09 D 2010-05-04T17:38:42
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in d83a0ffef3dcbfb08b410a6c6dd6c009ec9167fb F Makefile.in d83a0ffef3dcbfb08b410a6c6dd6c009ec9167fb
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -224,7 +224,7 @@ F src/vdbeblob.c 5327132a42a91e8b7acfb60b9d2c3b1c5c863e0e
F src/vdbemem.c 2a82f455f6ca6f78b59fb312f96054c04ae0ead1 F src/vdbemem.c 2a82f455f6ca6f78b59fb312f96054c04ae0ead1
F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2 F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2
F src/vtab.c a0f8a40274e4261696ef57aa806de2776ab72cda F src/vtab.c a0f8a40274e4261696ef57aa806de2776ab72cda
F src/wal.c 864f1e2036eb9e0131287e3ebe53e69990e19b7f F src/wal.c 73d17ad0d6a88e00ce5ac849c5f176cadd9ff375
F src/wal.h b4c42014b5fa3b4e6244ac8c65de7ff67adeb27c F src/wal.h b4c42014b5fa3b4e6244ac8c65de7ff67adeb27c
F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
F src/where.c 75fee9e255b62f773fcadd1d1f25b6f63ac7a356 F src/where.c 75fee9e255b62f773fcadd1d1f25b6f63ac7a356
@@ -812,14 +812,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P 1465d3842c52aa7471f63deb47fe5b256d4e01c2 P 8f9d22d58c75ad7476c1eea8ba296347e30b7beb
R c0c153d254f17743fb5d4241f139732d R 8fbb8b98c2b4c7e4e790d9b614444182
U drh U drh
Z 37e1a86378a1623d112f18783b7915ac Z cd1e036df5c7f4b84b82fa991fe96193
-----BEGIN PGP SIGNATURE----- -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux) Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFL4FdSoxKgR168RlERAsJoAJ4grLIIql2W9tFYnBXach9uwbQ4uwCeONqc iD8DBQFL4FuloxKgR168RlERAuGdAKCKxpQuBFvFj5bt0Vv1gj+o6sGfqQCfZXDE
SqAXE6WVtdXxSlF/T06Hf0s= c8UJveZgjNHF+6e0sDdZ4FI=
=HALZ =CRPz
-----END PGP SIGNATURE----- -----END PGP SIGNATURE-----

View File

@@ -1 +1 @@
8f9d22d58c75ad7476c1eea8ba296347e30b7beb b15b67fa14ff77963f470678ff6188c63be8e079

View File

@@ -562,6 +562,19 @@ finished:
return rc; return rc;
} }
/*
** Close an open wal-index
*/
static void walIndexClose(Wal *pWal){
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);
}
}
/* /*
** Open a connection to the log file associated with database zDb. The ** Open a connection to the log file associated with database zDb. The
** database file does not actually have to exist. zDb is used only to ** database file does not actually have to exist. zDb is used only to
@@ -613,7 +626,7 @@ int sqlite3WalOpen(
} }
if( rc!=SQLITE_OK ){ if( rc!=SQLITE_OK ){
if( pRet->pWIndex ) pVfs->xShmClose(pVfs, pRet->pWIndex, 0); walIndexClose(pRet);
sqlite3OsClose(pRet->pFd); sqlite3OsClose(pRet->pFd);
sqlite3_free(pRet); sqlite3_free(pRet);
}else{ }else{
@@ -819,7 +832,7 @@ int sqlite3WalClose(
walIndexUnmap(pWal); walIndexUnmap(pWal);
} }
pWal->pVfs->xShmClose(pWal->pVfs, pWal->pWIndex, isDelete); walIndexClose(pWal);
sqlite3OsClose(pWal->pFd); sqlite3OsClose(pWal->pFd);
if( isDelete ){ if( isDelete ){
sqlite3OsDelete(pWal->pVfs, pWal->zName, 0); sqlite3OsDelete(pWal->pVfs, pWal->zName, 0);