1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Have SQLITE_ENABLE_SETLK_TIMEOUT builds block when locking a read-lock slot.

FossilOrigin-Name: f797baf47cf7859cfd8ce248f4f3087af4551a7040af990333426e5a7c269504
This commit is contained in:
dan
2023-11-27 20:37:03 +00:00
parent e52854a9e6
commit bae2d0f2eb
3 changed files with 14 additions and 11 deletions

View File

@@ -1,5 +1,5 @@
C In\sSQLITE_ENABLE_SETLK_TIMEOUT\sbuilds,\suse\sblocking\slocks\sin\splace\sof\ssleep()\swhen\sopening\sa\sread-transaction. C Have\sSQLITE_ENABLE_SETLK_TIMEOUT\sbuilds\sblock\swhen\slocking\sa\sread-lock\sslot.
D 2023-11-27T19:22:50.016 D 2023-11-27T20:37:03.543
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -810,7 +810,7 @@ F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf8
F src/vdbevtab.c 2143db7db0ceed69b21422581f434baffc507a08d831565193a7a02882a1b6a7 F src/vdbevtab.c 2143db7db0ceed69b21422581f434baffc507a08d831565193a7a02882a1b6a7
F src/vtab.c 154725ebecd3bc02f7fbd7ad3974334f73fff76e02a964e828e48a7c5fb7efff F src/vtab.c 154725ebecd3bc02f7fbd7ad3974334f73fff76e02a964e828e48a7c5fb7efff
F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9 F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
F src/wal.c f64bf6799dbbd346a9e2aae9b96e51dbbb222d24a7e7509db85fb0144e8d9f38 F src/wal.c 86eaddc56b124de2df14dfaff292ca7bfb862dbd68728105547ddd6a1e799227
F src/wal.h ba252daaa94f889f4b2c17c027e823d9be47ce39da1d3799886bbd51f0490452 F src/wal.h ba252daaa94f889f4b2c17c027e823d9be47ce39da1d3799886bbd51f0490452
F src/walker.c 7c7ea0115345851c3da4e04e2e239a29983b61fb5b038b94eede6aba462640e2 F src/walker.c 7c7ea0115345851c3da4e04e2e239a29983b61fb5b038b94eede6aba462640e2
F src/where.c 1fdc69ce1333e9bd6d7d3df9fa5af1373a3f5bfdd52108d1dbc0ca85a55f777e F src/where.c 1fdc69ce1333e9bd6d7d3df9fa5af1373a3f5bfdd52108d1dbc0ca85a55f777e
@@ -2143,11 +2143,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P a0c87ae9d3db914d18e2c8811db0d0ae3ad7b15c63de84fa975efce28bace27e P a51ef39998e25e86bd0600e71d15011b12e05f4319608018293bdaecb09e8c97
R 35e10752e16b85b0bde20be6e18f8d14 R 50c3db5d407d996f614a56ca5cb31c30
T *branch * blocking-dms-lock
T *sym-blocking-dms-lock *
T -sym-trunk *
U dan U dan
Z fd8676cc431af47934a9227125e3da50 Z 3f1449733c562fe4e5bdc1215442e17e
# Remove this line to create a well-formed Fossil manifest. # Remove this line to create a well-formed Fossil manifest.

View File

@@ -1 +1 @@
a51ef39998e25e86bd0600e71d15011b12e05f4319608018293bdaecb09e8c97 f797baf47cf7859cfd8ce248f4f3087af4551a7040af990333426e5a7c269504

View File

@@ -2959,6 +2959,9 @@ static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int cnt){
int i; /* Loop counter */ int i; /* Loop counter */
int rc = SQLITE_OK; /* Return code */ int rc = SQLITE_OK; /* Return code */
u32 mxFrame; /* Wal frame to lock to */ u32 mxFrame; /* Wal frame to lock to */
#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
int nBlockTmout = 0;
#endif
assert( pWal->readLock<0 ); /* Not currently locked */ assert( pWal->readLock<0 ); /* Not currently locked */
@@ -2996,7 +2999,8 @@ static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int cnt){
** attempted read fails and (b) the shared lock taken on the DMS slot ** attempted read fails and (b) the shared lock taken on the DMS slot
** in os_unix.c. Both of these locks are attempted from within the ** in os_unix.c. Both of these locks are attempted from within the
** call to walIndexReadHdr() below. */ ** call to walIndexReadHdr() below. */
if( cnt>=10 && !useWal && walEnableBlockingMs(pWal, (nDelay+999)/1000) ){ nBlockTmout = (nDelay+998) / 1000;
if( !useWal && walEnableBlockingMs(pWal, nBlockTmout) ){
nDelay = 1; nDelay = 1;
} }
#endif #endif
@@ -3126,7 +3130,9 @@ static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int cnt){
return rc==SQLITE_BUSY ? WAL_RETRY : SQLITE_READONLY_CANTINIT; return rc==SQLITE_BUSY ? WAL_RETRY : SQLITE_READONLY_CANTINIT;
} }
(void)walEnableBlockingMs(pWal, nBlockTmout);
rc = walLockShared(pWal, WAL_READ_LOCK(mxI)); rc = walLockShared(pWal, WAL_READ_LOCK(mxI));
walDisableBlocking(pWal);
if( rc ){ if( rc ){
return rc==SQLITE_BUSY ? WAL_RETRY : rc; return rc==SQLITE_BUSY ? WAL_RETRY : rc;
} }