SQLite Forum

Is it safe to use unix-none VFS in concurrent reading to one database ?
Login

Is it safe to use unix-none VFS in concurrent reading to one database ?

(1) By anonymous on 2021-08-19 03:15:29 [link] [source]

I'd like to use concurrent reading to one database in multiple threads. Each thread holds its own database connection to the same database file. However, my filesystem & OS supports neither posix locking neither flock system call. It looks I can only use sem locking style which means all locks are exclusive.

What if I can control the reading and writing to a database won't happen at the same time, can I use "unix-none" VFS to eliminate all file locking code ? Will the concurrent reading without sqlite locking system be safe ?

(2) By Richard Hipp (drh) on 2021-08-19 14:21:42 in reply to 1 [source]

if I can control the reading and writing to a database won't happen at the same time, can I use "unix-none" VFS

That will work in theory. However, unless you are an extraordinary programmer, there will be bugs in your logic that separates reading and writing, which will ultimately cause problems, subtle and hard-to-reproduce problems.