Andrew Moss wrote:
> ... an SQLite database hosted on a windows network share (using server
> 2012 R2 or later). We are well aware this is not advisable

There are three possible sources of network filesystem data corruption:

1) Bad locking implementations.  Some Unix-y network filesystems
   products allow to disable locking (in a misguided attempt to increase
   performance), or do not implement locking at all.

   This can happen not only for pure Unix implementations, but also for
   NFS-on-Windows products, and SMB-on-Unix products.  Pure Windows,
   however, is safe from this.  (Please note that most NAS devices are
   not pure Windows.)

2) Bugs.  Older Windows versions have had some bugs, but those were
   fixed, so if you're running the latest updates, you are safe.

3) Intermittent network faults.  Windows can use oplocks (opportunistic
   locks), where the server allows the clients to cache changed data
   locally, even after the lock has been released, and asks for that
   data only when some other client want to read it.  This breaks if
   a network fault prevents the client from sending the changed data to
   the server, and, after a timeout, the server assumes that the client
   has crashed.  In that case, the data could be inconsistent because
   other changed data did make it, or because the changed data will be
   sent to the server too late (when the network works again).

   TCP/IP is more robust than the NetBEUI/NBF protocol uses by older
   Windows versions, so this problem should be much less likely nowadays.

   Oplocks will not bring a performance improvement if changed data is
   likely to be read by other clients anyway.  So in this case, you
   might want to disable them:
   
https://support.microsoft.com/en-us/help/296264/configuring-opportunistic-locking-in-windows

> My question is, if we limit the application (through other means) to a
> single writer, but allow multiple readers, does that remove the risk of
> database corruption from multiple SQLite processes?

Locks are also used to coordinate between readers and writers, so this
does not actually reduce the risk by much.

> Any notes from other users who had to do something similar in the past?

We have one customer with network-shared SQLite DBs on Windows.  There
are no known problems, but there is very little actual concurrency.


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to