diff options
author | stephan <stephan@noemail.net> | 2024-06-12 12:36:02 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2024-06-12 12:36:02 +0000 |
commit | fd70ca40cc22ea901a5d9595fa7bf741a87c2176 (patch) | |
tree | b9958af89a71f632bbfb99c431e05b238d5c3fa4 /ext/wasm/api/sqlite3-vfs-opfs.c-pp.js | |
parent | 01f07a61e47fbafd4d89b9ab2ee728dae4938515 (diff) | |
download | sqlite-fd70ca40cc22ea901a5d9595fa7bf741a87c2176.tar.gz sqlite-fd70ca40cc22ea901a5d9595fa7bf741a87c2176.zip |
OPFS VFS: change the xCheckReservedLock() impl to always return false, as discussed in [forum:a2f573b00cda1372|forum thread a2f573b00cda1372]. This does not impact any current tests, and may have no direct impact at all because of how that VFS handles locking, but is hypothetically a more correct solution than the previous one.
FossilOrigin-Name: c298b8ba2dcd01fa28b79a78bb4986fa0282755a0a36b7f38b93096ac31f521e
Diffstat (limited to 'ext/wasm/api/sqlite3-vfs-opfs.c-pp.js')
-rw-r--r-- | ext/wasm/api/sqlite3-vfs-opfs.c-pp.js | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js b/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js index a2ad6ad3e..45e8c4889 100644 --- a/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js +++ b/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js @@ -715,12 +715,23 @@ const installOpfsVfs = function callee(options){ file. We have no way of checking whether any _other_ db connection has a lock except by trying to obtain and (on success) release a sync-handle for it, but doing so would - involve an inherent race condition. For the time being, + involve an inherent race condition and would require + waiting on the async proxy (which might be tied up for + arbitrarily long with unrelated work). For the time being, pending a better solution, we simply report whether the given pFile is open. + + Update 2024-06-12: based on forum discussions, this + function now always sets pOut to 0 (false): + + https://sqlite.org/forum/forumpost/a2f573b00cda1372 */ - const f = __openFiles[pFile]; - wasm.poke(pOut, f.lockType ? 1 : 0, 'i32'); + if(1){ + wasm.poke(pOut, 0, 'i32'); + }else{ + const f = __openFiles[pFile]; + wasm.poke(pOut, f.lockType ? 1 : 0, 'i32'); + } return 0; }, xClose: function(pFile){ @@ -736,7 +747,6 @@ const installOpfsVfs = function callee(options){ return rc; }, xDeviceCharacteristics: function(pFile){ - //debug("xDeviceCharacteristics(",pFile,")"); return capi.SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN; }, xFileControl: function(pFile, opId, pArg){ |