Charles Girardot wrote: > I have a question related to BASE 1 and the flock mechanism. I am > about to move our BASE installation and data dir will be accessed by > NFS (and I'd like to keep using the flock locking). In > config.inc.php, it says that : > // Whether to use flock() for the locking needed by BASE. If your > // tempDir is on NFS or VFAT or some other file system which does > // not support flock(), you _must_ turn this off. The BaseControl > // table of the relational database will then be used for locking. > > Should I understand that all data directories but tempDir can be > located on NFS without troubles?
Hi Charles. That's right. If the tempDir (which contains the locking file) is on NFS or some other file system that doesn't support the flock mechanism, a call to flock() will always succeed, like on a door that's always unlocked. (There are other file-based mechanisms that we could've used instead, but flock was the easiest solution. The other way of doing locking goes through the database, which could make some sense if you have two web servers for the same BASE installation, but then you'd still have a common file system for all the data files except maybe the temp stuff. I'm not claiming that using the database for locking was a good design choice...) So anyway, all the other data directories can be on NFS. It probably makes most sense to have tempDir on a local disk anyway, since it's used for (potentially huge) short-lived temporary files. Here's a bash one-liner you can use to test whether a particular directory works with flock. It should print A B but when I tried it on NFS it printed B and then (oddly enough) stopped the process that was supposed to print A. I hope the one-liner doesn't fall apart in transmission, but if it does just put it back together again. php -r '$f=fopen("test.lock","w");flock($f,LOCK_EX);sleep(3);echo "A\n";' & php -r 'sleep(1);$f=fopen("test.lock","w");flock($f,LOCK_EX);echo "B\n";' ; wait //Carl -- Carl Troein - [EMAIL PROTECTED] http://www.thep.lu.se/~carl/ ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ The BASE general discussion mailing list basedb-users@lists.sourceforge.net unsubscribe: send a mail with subject "unsubscribe" to [EMAIL PROTECTED]