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

Riak should manage backend lock files. #535

Open
evanmcc opened this issue Apr 15, 2014 · 0 comments
Open

Riak should manage backend lock files. #535

evanmcc opened this issue Apr 15, 2014 · 0 comments
Labels
Milestone

Comments

@evanmcc
Copy link
Contributor

evanmcc commented Apr 15, 2014

There have been a couple of issues on bitcask and I think at least one on leveldb where stale lock files keep the system or particular vnodes from starting up. There've been repeated requests (basho/bitcask#99, basho/bitcask#163) to manage this at the backend level, but IMO, that's the wrong place to handle it, since there are various corner cases that the backend really shouldn't be responsible for detecting. I lay out some of my thinking here:
basho/bitcask#99 (comment)

The ideal thing in my mind is to have riak at the top/service level guarantee uniqueness, and then to extend the backend API to have a cleanup_locks call when riak/some other containing application has determined that it's totally safe to do so.

This was kind of a distant corner case before, but as containerization gets more common, we're seeing this more and more, and that trend looks only to increase, so best to deal with it soon.

cc @bsparrow435 @joecaswell

@evanmcc evanmcc added this to the 2.1 milestone Apr 15, 2014
@evanmcc evanmcc added the Bug label Apr 15, 2014
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
Labels
Projects
None yet
Development

No branches or pull requests

1 participant