On 27 April 2016 at 13:01, Mark Foley <mfoley at novatec-inc.com> wrote:
>
> Can sqlite handle contention among multiple accessors with read/write if
> the
> accessors are not on the same host? I.e. is locking intrinsic in sqlite
> and any
> accessor from any host is able to determine and set a row/table lock?
>

That depends on the journal mode, and the file systems used to access the
database.

WAL is not suitable for access via multiple hosts as it relies on shared
memory.

sqlite relies on the locking primitives provided by the file system - for
this to work across hosts the network file system has to plumb the locking
calls through to the host system correctly. For a quick test you can open
the sqlite3 shell on the same database on both the file server and remote
machine - run "BEGIN IMMEDIATE;" in one and then run "BEGIN IMMEDIATE;" in
the other. On the second attempt you should encounter "database is locked".
That demonstrates the network file system at least propagates locks, but
doesn't prove it behaves correctly in all scenarios (there may be race
conditions etc).

-Rowan

Reply via email to