Re: [sqlite] Locking issue on NFS filesystem
> int sqlite3_open_v2( > const char *filename, /* Database filename (UTF-8) */ > sqlite3 **ppDb, /* OUT: SQLite db handle */ > int flags, /* Flags */ > const char *zVfs/* Name of VFS module to use */ > ); > > With the last argument "unix-dotfile". > > Does it work? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Locking issue on NFS filesystem
Hi, Do you mean I shall use int sqlite3_open_v2( const char *filename, /* Database filename (UTF-8) */ sqlite3 **ppDb, /* OUT: SQLite db handle */ int flags, /* Flags */ const char *zVfs/* Name of VFS module to use */ ); With the last argument "unix-dotfile". BTW I am using it just as one uses database and our app also has connectors to client/server RDBMS. We use sqlite in a mode where app is used for in a mode where only one process uses it and moreover the process is single threaded too. Regards, Prakash From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] On Behalf Of Roger Binns [rog...@rogerbinns.com] Sent: Monday, June 14, 2010 8:30 AM To: General Discussion of SQLite Database Subject: Re: [sqlite] Locking issue on NFS filesystem -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 06/14/2010 02:56 AM, Prakash Reddy Bande wrote: > Our application is a simple desktop application with a simple install and run > setup. It is not possible to tell users to apply workaround of sharing the > drive via SMB etc. BTW SMB won't be much better than NFS. (A lot of things have to line up right.) You haven't specified if you are using SQLite because it is a convenient file format or because the transactions and durability matter. If it is the latter then you cannot use a networked filesystem. > I was hoping we have a way to enable dot file locking. It is available by default. Use "unix-dotfile" as the VFS name in your open call. Roger -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkwWIP8ACgkQmOOfHg372QT6YQCZAVqZLFg94FlljT7PkZz0jkxP RH8AoI2daz7YpQ3K7aYNVkG4Qpojqhdf =jh3O -END PGP SIGNATURE- ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Locking issue on NFS filesystem
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 06/14/2010 02:56 AM, Prakash Reddy Bande wrote: > Our application is a simple desktop application with a simple install and run > setup. It is not possible to tell users to apply workaround of sharing the > drive via SMB etc. BTW SMB won't be much better than NFS. (A lot of things have to line up right.) You haven't specified if you are using SQLite because it is a convenient file format or because the transactions and durability matter. If it is the latter then you cannot use a networked filesystem. > I was hoping we have a way to enable dot file locking. It is available by default. Use "unix-dotfile" as the VFS name in your open call. Roger -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkwWIP8ACgkQmOOfHg372QT6YQCZAVqZLFg94FlljT7PkZz0jkxP RH8AoI2daz7YpQ3K7aYNVkG4Qpojqhdf =jh3O -END PGP SIGNATURE- ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Locking issue on NFS filesystem
Hi, Our application is a simple desktop application with a simple install and run setup. It is not possible to tell users to apply workaround of sharing the drive via SMB etc. I was hoping we have a way to enable dot file locking. For Mac OS X, sqlite allows SQLITE_ENABLE_LOCKING_STYLE compile option, why not leverage that for NFS issues too? May be I am completely wrong, but I feel dot file locking may work as long as file read/write/execute permissions are available. Switching SQLITE_ENABLE_LOCKING_STYLE on RHEL resulted in compile errors. There is no configure option but by setting CFLAGS, CCFLAGS I tried compile sqlite with this option. Regards, From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] On Behalf Of Simon Slavin [slav...@bigfraud.org] Sent: Sunday, June 13, 2010 10:38 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] Locking issue on NFS filesystem On 14 Jun 2010, at 3:16am, Prakash Reddy Bande wrote: > I have stumbled upon the issue as described in http://sqlite.org/faq.html#q5 > (But use caution: this locking mechanism might not work correctly if the > database file is kept on an NFS filesystem.) > > The question is, do we have a workaround. Our application has to store data > in user home directory (RHEL/SLES/CentOS) and the home directory might be on > a NFS device (as is my home directory). > stat -f -c %X /users/prakash returns nfs. Which version of NFS ? Locking was introduced in version 4. However, locking even under NFS sucks. That warning in the SQLite FAQ isn't there because the writers of SQLite are bad programmers, it's there because locking under many NFS installations is not implemented properly. You may have an alternative of accessing your NFS drive as a shared drive. If you do this, then locking is implemented by the networking protocol, not by the driver of the space being shared. So if you have a way of sharing your NFS drive via SMB or AFS, or some other common space-sharing system, you might be able to get around the NFS problems completely. Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Locking issue on NFS filesystem
On 14 Jun 2010, at 3:16am, Prakash Reddy Bande wrote: > I have stumbled upon the issue as described in http://sqlite.org/faq.html#q5 > (But use caution: this locking mechanism might not work correctly if the > database file is kept on an NFS filesystem.) > > The question is, do we have a workaround. Our application has to store data > in user home directory (RHEL/SLES/CentOS) and the home directory might be on > a NFS device (as is my home directory). > stat -f -c %X /users/prakash returns nfs. Which version of NFS ? Locking was introduced in version 4. However, locking even under NFS sucks. That warning in the SQLite FAQ isn't there because the writers of SQLite are bad programmers, it's there because locking under many NFS installations is not implemented properly. You may have an alternative of accessing your NFS drive as a shared drive. If you do this, then locking is implemented by the networking protocol, not by the driver of the space being shared. So if you have a way of sharing your NFS drive via SMB or AFS, or some other common space-sharing system, you might be able to get around the NFS problems completely. Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Locking issue on NFS filesystem
Hi, I have stumbled upon the issue as described in http://sqlite.org/faq.html#q5 (But use caution: this locking mechanism might not work correctly if the database file is kept on an NFS filesystem.) The question is, do we have a workaround. Our application has to store data in user home directory (RHEL/SLES/CentOS) and the home directory might be on a NFS device (as is my home directory). stat -f -c %X /users/prakash returns nfs. I am vaguely imagining if we could (at compile or run time) have SQLite use dot file locking. Let me describe the problem I am facing. The database file does not exist and the call to sqlite3_open, does not return (or atleast does not return as long as I waited ~10 mins). I killed the process using kill / kill -9, but process went into zombie state. Also I observed that the database file got created (may not be usable) and another file nfs00. was created and locked by my app. I compiled the latest sqlite 3.6.23.1 and ran the following command sqlite /users/prakash/test.db I got the sqlite command prompt, however, the command .tables resulted in hang. So, again, I am trying to figure out a solution/workaround. Concurrency is not the most major concern and hence if we can use a different locking mechanism, that will be nice. Regards, Prakash ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users