diff options
author | drh <drh@noemail.net> | 2010-04-30 17:47:51 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2010-04-30 17:47:51 +0000 |
commit | 6dea3248aefe879dbb9a186e632fd65b15920299 (patch) | |
tree | 6793ebff8f4b6081d4f4439e77e2d3b8d1f166d6 /src/os_unix.c | |
parent | 1b48aa49a4497e418241a46ba110b160dadee4ba (diff) | |
download | sqlite-6dea3248aefe879dbb9a186e632fd65b15920299.tar.gz sqlite-6dea3248aefe879dbb9a186e632fd65b15920299.zip |
Change the SHM VFS logic in os_unix.c so that it does not hold an exclusive
lock n the mapped memory when also holding a CHECKPOINT lock. This
improves concurrency between readers and checkpointers.
FossilOrigin-Name: 8660cda6f8ef43bd276897ef3b5fc2376b5684dc
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index 483978673..f37afa1f1 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -5140,7 +5140,10 @@ static int unixShmGet( unixShmFile *pFile = p->pFile; int rc = SQLITE_OK; - sqlite3_mutex_enter(pFile->mutexBuf); + if( p->lockState!=SQLITE_SHM_CHECKPOINT ){ + sqlite3_mutex_enter(pFile->mutexBuf); + p->hasMutexBuf = 1; + } sqlite3_mutex_enter(pFile->mutex); if( pFile->szMap==0 || reqMapSize>pFile->szMap ){ int actualSize; @@ -5168,8 +5171,11 @@ static int unixShmGet( */ static int unixShmRelease(sqlite3_shm *pSharedMem){ unixShm *p = (unixShm*)pSharedMem; - unixShmFile *pFile = p->pFile; - sqlite3_mutex_leave(pFile->mutexBuf); + if( p->hasMutexBuf ){ + unixShmFile *pFile = p->pFile; + sqlite3_mutex_leave(pFile->mutexBuf); + p->hasMutexBuf = 0; + } return SQLITE_OK; } |