mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Reinstate the assert() removed by [0f6223b8]. Avoid holding a wal-mode write lock after the transaction has been rolled back if an IO error occurs while restarting the wal file.
FossilOrigin-Name: 277e150d6ab75de2407f6761aa2359df80a4e1dbce30788df06621dee05b2ef1
This commit is contained in:
@@ -1846,6 +1846,15 @@ static void pager_unlock(Pager *pPager){
|
||||
|
||||
if( pagerUseWal(pPager) ){
|
||||
assert( !isOpen(pPager->jfd) );
|
||||
if( pPager->eState==PAGER_ERROR ){
|
||||
/* If an IO error occurs in wal.c while attempting to wrap the wal file,
|
||||
** then the Wal object may be holding a write-lock but no read-lock.
|
||||
** This call ensures that the write-lock is dropped as well. We cannot
|
||||
** have sqlite3WalEndReadTransaction() drop the write-lock, as it once
|
||||
** did, because this would break "BEGIN EXCLUSIVE" handling for
|
||||
** SQLITE_ENABLE_SETLK_TIMEOUT builds. */
|
||||
sqlite3WalEndWriteTransaction(pPager->pWal);
|
||||
}
|
||||
sqlite3WalEndReadTransaction(pPager->pWal);
|
||||
pPager->eState = PAGER_OPEN;
|
||||
}else if( !pPager->exclusiveMode ){
|
||||
|
Reference in New Issue
Block a user