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

Parallel database access handles #8

Open
brodycj opened this issue Jan 18, 2018 · 0 comments
Open

Parallel database access handles #8

brodycj opened this issue Jan 18, 2018 · 0 comments

Comments

@brodycj
Copy link
Member

brodycj commented Jan 18, 2018

Parallel database access from multiple main/worker threads can be problematic for reasons discussed in #3. (Parallel database access handles would also be key to solving cordova-sqlite-storage bug 666 correctly in this plugin version as discussed in #7.) I think the most correct solution is to use parallel database access handles in a similar fashion to https://github.com/brodybits/cordova-sqlite-evmax-legacy-exp-free, assuming the parallel reader/writer interference issue in brodycj/cordova-sqlite-evmax-legacy-exp-free#1 is solved.

Parallel writer interference could also be an issue in case of parallel database handles in this plugin version due to access from multiple JavaScript threads. The one solution I can think of is to deal with the interference problem on the native side.

An alternative solution to the interference problem would be to WAL mode. As documented in (https://www.sqlite.org/wal.html#overview):

WAL provides more concurrency as readers do not block writers and a writer does not block readers. Reading and writing can proceed concurrently.

Another advantage of WAL is that it may be more robust against possible corruption. From storesafe/cordova-sqlite-storage-help#10 (comment):

I was thinking that WAL may be more robust against possible database corruption and found a couple threads that confirm WAL may be more reliable, at least in certain cases:

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

No branches or pull requests

1 participant