Replies: 1 comment
-
Sorry, the question is based on an invalid assumption. In WAL mode this should not be happening. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
WatermelonDB (WMDB) uses exclusive locking on the database during transactions, even when it's not explicitly enabled with the
usesExclusiveLocking
config flag.This is due to the transactions being started as
BEGIN EXCLUSIVE TRANSACTION
, as opposed to the normal "deferred" behavior which still allows locking.The net effect is that exclusive transactions cause other connections to fail to execute or open with the error code
5
: and messagedatabase is locked
. So in its default behavior, this exclusive WMDB from being used in a native + RN environment unless it's patched to support it.Has there been any testing with it off or perhaps would it be possible to disable it and just rely on normal locking?
Code seen here:
https://github.com/Nozbe/WatermelonDB/blob/62774d5ebc4aa9ed6a2f61c8d4e795b32322cec6/native/shared/Database-sqlite.cpp#L259C7-L259C7
ie:
Reference reading:
https://www.sqlite.org/lang_transaction.html#deferred_immediate_and_exclusive_transactions
https://www2.sqlite.org/cvstrac/wiki?p=DatabaseIsLocked
Beta Was this translation helpful? Give feedback.
All reactions