Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Robustify bitcask lock file creation #72

Open
slfritchie opened this issue Nov 16, 2012 · 1 comment
Open

Robustify bitcask lock file creation #72

slfritchie opened this issue Nov 16, 2012 · 1 comment

Comments

@slfritchie
Copy link
Contributor

The current method of creating lock files is mostly good enough, especially with the recent testing by QuickCheck. However, it's probably a good idea to use the rename method used by riak_core_util:replace_file/2. h/t @gburd for reminding me.

@slfritchie slfritchie added this to the 2.1 milestone Mar 24, 2014
@evanmcc
Copy link
Contributor

evanmcc commented Apr 16, 2014

There have been a number of flare-ups on this front, lately, #163, etc. Ideally we'd write a test to exhibit the problem then work on getting it fixed. Relatedly, basho/riak#535 should be worked on to handle the numerous stale lockfile on startup issues that we've been seeing.

My proposal would be to consolidate all bugs into this bug and 535, to make the actual state of things clear.

andytill added a commit to andytill/bitcask that referenced this issue Feb 9, 2018
…le creation

Previous to this change, the OS pid was used to lock the bitcask database
and prevent two bitcask instances performing write operations at the same
time. However, if bitcask is not able to clean up the write locks because
of a hard shutdown and another process takes that the pid in written to
the lock file, bitcask is not able to take the lock even though it is the
only running instance.

This change uses the flock system call to obtain exclusive write access
to the file across OS processes, as long as the other processes use flock
to obtain the lock.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants