OlegDB icon indicating copy to clipboard operation
OlegDB copied to clipboard

Implement Locking with flock/fcntl

Open qpfiffer opened this issue 10 years ago • 2 comments

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.

qpfiffer avatar May 27 '14 06:05 qpfiffer

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.)

Hamcha avatar May 27 '14 13:05 Hamcha

This is now the "Implement Locking" ticket.

qpfiffer avatar Sep 11 '14 03:09 qpfiffer