OlegDB
OlegDB copied to clipboard
Implement Locking with flock/fcntl
Things that should lock the database:
- Transactions
- Cursor iteration
- Any operation until that operation is complete (jar, unjar, cas, squish, etc.)
Hamcha brought up the issue of using mutliple processes to access the same file. While without internet I've been perusing the Kyoto Cabinet source code. Turns out file based locking is builtin to POSIX: http://linux.die.net/man/2/fcntl
Rad.
Noice! There's apparently also flock(2) which is for the entire file, while fcntl(2) seems to be intended only for a portion of a given file. flock(2) also seems to block if there is another lock, which maybe could be used to achieve multiprocess access if used correctly. (probably not, I don't know that much about Oleg's internals when it comes to file handling.. or linux's, for that matter.)
This is now the "Implement Locking" ticket.