mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-05 15:55:57 +03:00
It turns out that pagerExclusiveLock() can be called with the lock state
already set to RESERVED if the SQLITE_FCNTL_PERSIST_WAL setting is set and a specific sequence of multiple journal mode changes occur. Enhance pagerExclusiveLock() to deal with this. [forum:/forumpost/8130545bc6|Forum post 8130545bc6] FossilOrigin-Name: 2bb8d977392f635515aa4a36f6f763a2e4858f7adc1120519e2e74c04a9749b5
This commit is contained in:
@@ -7473,13 +7473,15 @@ int sqlite3PagerWalSupported(Pager *pPager){
|
||||
*/
|
||||
static int pagerExclusiveLock(Pager *pPager){
|
||||
int rc; /* Return code */
|
||||
u8 eOrigLock; /* Original lock */
|
||||
|
||||
assert( pPager->eLock==SHARED_LOCK || pPager->eLock==EXCLUSIVE_LOCK );
|
||||
assert( pPager->eLock>=SHARED_LOCK );
|
||||
eOrigLock = pPager->eLock;
|
||||
rc = pagerLockDb(pPager, EXCLUSIVE_LOCK);
|
||||
if( rc!=SQLITE_OK ){
|
||||
/* If the attempt to grab the exclusive lock failed, release the
|
||||
** pending lock that may have been obtained instead. */
|
||||
pagerUnlockDb(pPager, SHARED_LOCK);
|
||||
pagerUnlockDb(pPager, eOrigLock);
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
Reference in New Issue
Block a user