Breaking changes to IndexedDbVFS #45
rhashimoto
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I made a lot of progress with the IndexedDB versioned page store idea. I'm pretty happy with it now, so I merged it to the public branches. There are a few differences with it:
The name passed as the first argument to the IndexedDbVFS constructor is now also the VFS name, i.e. the VFS specifier passed to
sqlite.open_v2()
. In the previous version the VFS name was always "idb". I made this change to allow attaching multiple instances of IndexedDbVFS, e.g. with different IndexedDB databases and/or options.The constructor now takes an optional options object argument. The only recognized property at this time is "durability", which can be "default", "strict", or "relaxed". This argument is used for IDBTransaction creation and also within the VFS to trade off durability for performance. The benchmarks page now has a column for relaxed durability. The gains can be significant, depending on your browser, especially if you can also use
PRAGMA locking_mode=exclusive
(while the locks themselves aren't that expensive, lock transitions cause IndexedDB transactions to auto-commit).Because all the VFS classes are considered sample code, I'm only upgrading pre-existing IndexedDB object stores for the immediately preceding IndexedDB schema (i.e. version 4 → 5). If you have object stores that need preserving that are older than that, you can splice the old upgrade code into the new code.
In the previous version, you could use a journal mode of "MEMORY" or even "OFF" without risking database corruption. That is no longer the case so I strongly recommend not using these modes. One of the primary benefits of the versioned page store is very low overhead for rollback journals (which is the default) so this should not be a major drawback.
Beta Was this translation helpful? Give feedback.
All reactions