3

I'm having a locking problem where an SQLITE3 databse is permanently locked when created on an NFS file system. I have read that an option called nobrl can help this issue when the file system in question is CIFS. (its an option to the mount command).

From: http://linux.die.net/man/8/mount.cifs

nobrl

Do not send byte range lock requests to the server. This is necessary for certain applications that break with cifs style mandatory byte range locks (and most cifs servers do not yet support requesting advisory byte range locks).

Is there any way to stop byte-range-lock requests in NFS if they occur, or am I running in the wrong direction by even thinking about this? I'm happy to change the mount command as was done for the CIFS solution.

John Humphreys
  • 37,047
  • 37
  • 155
  • 255
  • Well, you could mount with `nolock` (see the nfs(5) manpage), but that really seams like a bad idea. – derobert Sep 27 '11 at 17:37
  • SQLite's really very keen on using locking (all databases worth the name are) so is it really necessary to put the DB on an NFS mount? Locks never work especially well with networked filesystems (it's always necessary to gimp the semantics of some operations because of the nature of networking…) – Donal Fellows Sep 29 '11 at 07:50

1 Answers1

0

I recommend to open you sqlite db by software with nolock parameter enabled, golang exg.:

sql.Open("sqlite3", "file:/media/R/Databases//your.db?nolock=1")

while /media/R is a mounted windows nfs-network-drive. Be carefull because you have to lock your db interactions by software otherwise you could corrupt your db, when accessing it simultaneously.

You can read more about sqlite parameters here: https://www.sqlite.org/c3ref/open.html

Nikolai Ehrhardt
  • 570
  • 4
  • 14