aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordan <Dan Kennedy>2025-01-24 15:49:47 +0000
committerdan <Dan Kennedy>2025-01-24 15:49:47 +0000
commit2539fb2bc57adebef779a13c18f788e14461f7c8 (patch)
treed41f540bd0391f0c407784cf5cca2407821dbe4c /src
parentff6bff4059235a583bd7b1c1928a956c4ed9b4f6 (diff)
downloadsqlite-2539fb2bc57adebef779a13c18f788e14461f7c8.tar.gz
sqlite-2539fb2bc57adebef779a13c18f788e14461f7c8.zip
Fix a race condition causing SQLite to use a busy-handler for an operation that should not.
FossilOrigin-Name: 6ab9ed8eef77781898375038ab05fc6e5f46b745e4906691393b8b1d90570eb6
Diffstat (limited to 'src')
-rw-r--r--src/wal.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/wal.c b/src/wal.c
index 42ce3cb97..707acfca5 100644
--- a/src/wal.c
+++ b/src/wal.c
@@ -3470,8 +3470,11 @@ int sqlite3WalBeginReadTransaction(Wal *pWal, int *pChanged){
** read-lock.
*/
void sqlite3WalEndReadTransaction(Wal *pWal){
- sqlite3WalEndWriteTransaction(pWal);
+#ifndef SQLITE_ENABLE_SETLK_TIMEOUT
+ assert( pWal->writeLock==0 || pWal->readLock<0 );
+#endif
if( pWal->readLock>=0 ){
+ sqlite3WalEndWriteTransaction(pWal);
walUnlockShared(pWal, WAL_READ_LOCK(pWal->readLock));
pWal->readLock = -1;
}
@@ -3664,7 +3667,7 @@ int sqlite3WalBeginWriteTransaction(Wal *pWal){
** read-transaction was even opened, making this call a no-op.
** Return early. */
if( pWal->writeLock ){
- assert( !memcmp(&pWal->hdr,(void *)walIndexHdr(pWal),sizeof(WalIndexHdr)) );
+ assert( !memcmp(&pWal->hdr,(void*)pWal->apWiData[0],sizeof(WalIndexHdr)) );
return SQLITE_OK;
}
#endif