liuis / leveldb

Automatically exported from code.google.com/p/leveldb
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

add support to detect and to prevent multiple callers of the same UNIX process from simultaneously opening the same database #49

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Add support to detect and to prevent multiple callers of the same UNIX process 
from simultaneously opening the same database.

Excerpt from previous exchange on leveldb mailing list:

------
Sanjay Ghemawat
View profile
 More options Sep 30, 1:04 am
On Thu, Sep 29, 2011 at 8:30 AM, Joseph Wayne Norton wrote:
> Hans -
> Thanks.  Is is correct to assume that it is the caller's responsibility to
> ensure this does not happen?

leveldb guarantees that it will catch when two distinct processes
try to open the db concurrently. However it doesn't guarantee what happens
if the same process tries to do so and therefore it is the caller's
responsibility
to check for concurrent opens from the same process.
This is ugly, but the unix file locking primitives are very annoying in
this regard. I'll think about whether or not we should clean up the spec
by doing extra checks inside the leveldb implementation.
------

Original issue reported on code.google.com by josephwn...@gmail.com on 29 Oct 2011 at 12:11

GoogleCodeExporter commented 9 years ago
Fixed in 1.6.0 by adding an in-process lock table to augment fcntl based 
locking.

Original comment by san...@google.com on 16 Oct 2012 at 11:35