mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-05 15:55:57 +03:00
Do not invoke the busy callback when trying to promote a lock from SHARED
to RESERVED. This avoids a deadlock. (CVS 1879) FossilOrigin-Name: d33771a303d9c20dd477b1a973024ff763203211
This commit is contained in:
12
src/pager.c
12
src/pager.c
@@ -18,7 +18,7 @@
|
||||
** file simultaneously, or one process from reading the database while
|
||||
** another is writing.
|
||||
**
|
||||
** @(#) $Id: pager.c,v 1.153 2004/07/22 15:02:25 drh Exp $
|
||||
** @(#) $Id: pager.c,v 1.154 2004/08/07 23:54:48 drh Exp $
|
||||
*/
|
||||
#include "os.h" /* Must be first to enable large file support */
|
||||
#include "sqliteInt.h"
|
||||
@@ -2414,6 +2414,7 @@ int sqlite3pager_begin(void *pData){
|
||||
pPager->state = PAGER_EXCLUSIVE;
|
||||
pPager->origDbSize = pPager->dbSize;
|
||||
}else{
|
||||
#if 0
|
||||
int busy = 1;
|
||||
do {
|
||||
rc = sqlite3OsLock(&pPager->fd, RESERVED_LOCK);
|
||||
@@ -2422,7 +2423,16 @@ int sqlite3pager_begin(void *pData){
|
||||
pPager->pBusyHandler->xFunc &&
|
||||
pPager->pBusyHandler->xFunc(pPager->pBusyHandler->pArg, busy++)
|
||||
);
|
||||
#endif
|
||||
rc = sqlite3OsLock(&pPager->fd, RESERVED_LOCK);
|
||||
if( rc!=SQLITE_OK ){
|
||||
/* We do not call the busy handler when we fail to get a reserved lock.
|
||||
** The only reason we might fail is because another process is holding
|
||||
** the reserved lock. But the other process will not be able to
|
||||
** release its reserved lock until this process releases its shared
|
||||
** lock. So we might as well fail in this process, let it release
|
||||
** its shared lock so that the other process can commit.
|
||||
*/
|
||||
return rc;
|
||||
}
|
||||
pPager->state = PAGER_RESERVED;
|
||||
|
Reference in New Issue
Block a user