diff options
author | dan <Dan Kennedy> | 2025-06-02 18:48:36 +0000 |
---|---|---|
committer | dan <Dan Kennedy> | 2025-06-02 18:48:36 +0000 |
commit | 9269b212bf14b8dbd97fdd04fe70386e6b3ba584 (patch) | |
tree | 2c8326e57a9a1f1d10b0ed1849391143fdaa68f2 /src/os_unix.c | |
parent | 342ef63e638e167ef16e8fff5bc109e2aa3de344 (diff) | |
parent | 69ce758efa51906c9dad175e78893e160acc04f4 (diff) | |
download | sqlite-9269b212bf14b8dbd97fdd04fe70386e6b3ba584.tar.gz sqlite-9269b212bf14b8dbd97fdd04fe70386e6b3ba584.zip |
Fixes to ensure SQLITE_ENABLE_SETLK_TIMEOUT builds use a blocking lock and do not call xSleep() when (a) opening a snapshot transaction, and (b) when blocked by another process running recovery.
FossilOrigin-Name: 7f9c0cdd0630a41db359b188b226a1ad6a3bae1663c27169acfe25edc7fb171b
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index 1146545fe..784bc3517 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -5035,21 +5035,20 @@ static int unixShmLock( /* Check that, if this to be a blocking lock, no locks that occur later ** in the following list than the lock being obtained are already held: ** - ** 1. Checkpointer lock (ofst==1). - ** 2. Write lock (ofst==0). - ** 3. Read locks (ofst>=3 && ofst<SQLITE_SHM_NLOCK). + ** 1. Recovery lock (ofst==2). + ** 2. Checkpointer lock (ofst==1). + ** 3. Write lock (ofst==0). + ** 4. Read locks (ofst>=3 && ofst<SQLITE_SHM_NLOCK). ** ** In other words, if this is a blocking lock, none of the locks that ** occur later in the above list than the lock being obtained may be ** held. - ** - ** It is not permitted to block on the RECOVER lock. */ #if defined(SQLITE_ENABLE_SETLK_TIMEOUT) && defined(SQLITE_DEBUG) { u16 lockMask = (p->exclMask|p->sharedMask); assert( (flags & SQLITE_SHM_UNLOCK) || pDbFd->iBusyTimeout==0 || ( - (ofst!=2) /* not RECOVER */ + (ofst!=2 || lockMask==0) && (ofst!=1 || lockMask==0 || lockMask==2) && (ofst!=0 || lockMask<3) && (ofst<3 || lockMask<(1<<ofst)) |