• D
    Prevent concurrent multiple opens of leveldb database. · e56b2c5a
    Dhruba Borthakur 提交于
    Summary:
    The fcntl call cannot detect lock conflicts when invoked multiple times
    from the same thread.
    Use a static lockedFile Set to record the paths that are locked.
    A lockfile request checks to see if htis filename already exists in
    lockedFiles, if so, then it triggers an error. Otherwise, it inserts
    the filename in the lockedFiles Set.
    A unlock file request verifies that the filename is in the lockedFiles
    set and removes it from lockedFiles set.
    
    Test Plan: unit test attached
    
    Reviewers: heyongqiang
    
    Reviewed By: heyongqiang
    
    Differential Revision: https://reviews.facebook.net/D4755
    e56b2c5a
env_posix.cc 16.8 KB