Thanks for your response.
The link is useful, and will provide more information to consider, especially for other projects. In particular, if we move from the DBI to accessing the files directly, there will be some more research and testing.
Because we were looking at migrating the app to multiple servers and NFS, the daemon I wrote SHOULD HAVE worked as a networkable file access arbitrator, running on the NFS server. As I understand it, this is the way the Open Distributed Lock Manger is supposed to do it (reference "Linux Enterprise Cluster" by Karl Kopper). However, the most recent I can find on it is 2004 or 2006 on sourceforge.
I've seen such conflicting information on flock(), though, and have a hard time bringing myself to trust it. Maybe a real DB is my only solution. | [reply] |
Don't trust flock. It only works if your file is on the same physical system as your code. Even then, it doesn't always work. Furthermore, flock is only advisory. The OS doesn't enforce a flock to all processes.
Frankly, all flock does is put a flag on the file. If another process actually bothers to check the flag, the OS will let it know what the state is. If the other process just goes ahead and opens the file anyway, the OS will let it.
My criteria for good software:
- Does it work?
- Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
| [reply] |