Advertise shared memory only when the underlying VFS provides it - #623
Open
LucaCappelletti94 wants to merge 1 commit into
Open
LucaCappelletti94 wants to merge 1 commit into
LucaCappelletti94 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On 5.0.0-beta the VFS shim gives every file
sqlcipher_io_methods, whose shared memory entries are always set, whatever the underlying file offers. SQLite decides whether WAL is possible from those entries alone insqlite3PagerWalSupported, so over a base VFS without shared memoryPRAGMA journal_mode = WALanswerswaland every later write fails withSQLITE_IOERR_SHMMAP, on plaintext and keyed databases alike.That covers
unix-dotfile,unix-none, and anySQLITE_OS_OTHERbuild whose own VFS lacks shared memory, sincesqlite3_initializerunssqlite3OsInitbeforeSQLITE_EXTRA_INITand the shim wraps that VFS. We hit it in CI with SQLCipher built for WebAssembly on the sqlite-wasm-rs platform layer, whosesqlite3_os_initinstalls an in-memory VFS with version 1 io methods. 4.19 over the same VFS keeps the rollback journal, as SQLite documents for WAL without shared memory.The shim now offers shared memory only when the file under it has it, with a second table shaped like SQLite's own
memdb_io_methods, so WAL availability matches the base VFS. WAL overunixis unchanged.The test uses a new
SQLCIPHER_TESTpragma to place the shim overunix-dotfileandunix-none, andsqlcipher.testpasses in full.