Skip to content

Parallel database access handles #8

@brody4hire

Description

@brody4hire

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 brody4hire/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:

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions