Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Evaluating WAL for Cordova SQLite plugin solutions #7

Open
brody4hire opened this issue Mar 11, 2020 · 2 comments
Open

Evaluating WAL for Cordova SQLite plugin solutions #7

brody4hire opened this issue Mar 11, 2020 · 2 comments

Comments

@brody4hire
Copy link
Owner

For redesign of SQLite plugin for Apache Cordova (#3), I would like to start evaluating whether or not to consider using WAL (https://www.sqlite.org/wal.html).

Use case: I think the primary benefit of WAL would be to alleviate possible blocking between writer(s) and readers, under the following kinds of circumstances:

  • Custom native Cordova plugin does read or write access, parallel to JavaScript
  • JavaScript code can initiate parallel read and write access, from different modules for example. (It should not be very hard to imagine multiple JavaScript modules starting multiple read and write operations in parallel, given that JavaScript was designed to be event-driven from its very beginning.) Discussed in the past here: Parallel database access handles litehelpers/cordova-sqlite-evmax-ext-workers-legacy-build-free#8

Major drawbacks (as discussed in storesafe/cordova-sqlite-storage#643 (comment) and storesafe/cordova-sqlite-storage-help#10):

Major advantages of using WAL (from storesafe/cordova-sqlite-storage-help#10):

I discovered some more resources from: https://www.google.com/search?q=how+does+sqlite+checkpoint+work

At this point I think that using WAL should be optional and should come with some warnings.

@brody4hire
Copy link
Owner Author

To keep the comparison as fair as possible, I would like to add that semantics of VACUUM (https://sqlite.org/lang_vacuum.html), where space for deleted data is not always cleaned up right away, seems to apply with and without WAL. But without WAL, SQLite would keep the deleted data pages in some kind of a "free list" where they could be used again. My understanding is that there are multiple forms of "auto vacuum", but a full "manual" vacuum would be better.

@brody4hire
Copy link
Owner Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant