sapling/eden/fs/store
Adam Simpkins 3bafd20a06 fix race conditions in RocksDbLocalStore access during shutdown
Summary:
This contains several fixes to LocalStore handling during shutdown.

- Have EdenServer explicitly call localStore_->close() during shutdown.
  This ensures that the local store really gets close, just in case some other
  part of the code somehow still has an outstanding shared_ptr reference to
  it.

- Add synchronization around internal access to the RocksDB object in
  RocksDbLocalStore.  This ensures that calling `close()` is safe even if
  there happens to still be some outstanding I/O operations.  In particular
  this helps ensure that if background GC operation is in progress that
  `close()` will wait until it completes before destroying the DB object.
  This also improves the code so that calling subsequent methods on a closed
  RocksDbLocalStore throws an exception, instead of simply crashing.

I don't believe the additional synchronization in RocksDbLocalStore should
have much impact on performance: the synchronization overhead should be very
low compared to the cost of the RocksDB reads/writes.

Ideally some of this synchronization logic should perhaps be moved into the
base `LocalStore` class: all of the different `LocalStore` implementations
should ideally ensure that `close()` is thread-safe and blocks until other
pending I/O operations are complete.  However, that requires a bigger
refactoring.  I may attempt that in a subsequent diff, but for now I mainly
want to address this problem just for RocksDbLocalStore.

Reviewed By: strager

Differential Revision: D15948382

fbshipit-source-id: 96d633ac0879b3321f596224907fcfe72691b3f0
2019-06-24 18:29:19 -07:00
..
git update license headers in CMake files 2019-06-19 17:02:46 -07:00
hg concurrently importing blobs from Mercurial and Mononoke 2019-06-24 13:45:02 -07:00
mononoke update license headers in CMake files 2019-06-19 17:02:46 -07:00
test update license headers in CMake files 2019-06-19 17:02:46 -07:00
BackingStore.h update license headers in C++ files 2019-06-19 17:02:45 -07:00
BlobAccess.cpp update license headers in C++ files 2019-06-19 17:02:45 -07:00
BlobAccess.h update license headers in C++ files 2019-06-19 17:02:45 -07:00
BlobCache.cpp update license headers in C++ files 2019-06-19 17:02:45 -07:00
BlobCache.h update license headers in C++ files 2019-06-19 17:02:45 -07:00
BlobMetadata.h update license headers in C++ files 2019-06-19 17:02:45 -07:00
CMakeLists.txt update license headers in CMake files 2019-06-19 17:02:46 -07:00
Diff.cpp update license headers in C++ files 2019-06-19 17:02:45 -07:00
Diff.h update license headers in C++ files 2019-06-19 17:02:45 -07:00
eden_store_util.cpp update license headers in C++ files 2019-06-19 17:02:45 -07:00
EmptyBackingStore.cpp update license headers in C++ files 2019-06-19 17:02:45 -07:00
EmptyBackingStore.h update license headers in C++ files 2019-06-19 17:02:45 -07:00
IObjectStore.h update license headers in C++ files 2019-06-19 17:02:45 -07:00
KeySpaces.h update license headers in C++ files 2019-06-19 17:02:45 -07:00
LocalStore.cpp enable automatic garbage collection for RocksDBLocalStore 2019-06-20 20:57:04 -07:00
LocalStore.h enable automatic garbage collection for RocksDBLocalStore 2019-06-20 20:57:04 -07:00
MemoryLocalStore.cpp update license headers in C++ files 2019-06-19 17:02:45 -07:00
MemoryLocalStore.h update license headers in C++ files 2019-06-19 17:02:45 -07:00
ObjectStore.cpp update license headers in C++ files 2019-06-19 17:02:45 -07:00
ObjectStore.h update license headers in C++ files 2019-06-19 17:02:45 -07:00
RocksDbLocalStore.cpp fix race conditions in RocksDbLocalStore access during shutdown 2019-06-24 18:29:19 -07:00
RocksDbLocalStore.h fix race conditions in RocksDbLocalStore access during shutdown 2019-06-24 18:29:19 -07:00
SerializedBlobMetadata.cpp update license headers in C++ files 2019-06-19 17:02:45 -07:00
SerializedBlobMetadata.h update license headers in C++ files 2019-06-19 17:02:45 -07:00
SqliteLocalStore.cpp update license headers in C++ files 2019-06-19 17:02:45 -07:00
SqliteLocalStore.h update license headers in C++ files 2019-06-19 17:02:45 -07:00
StoreResult.cpp update license headers in C++ files 2019-06-19 17:02:45 -07:00
StoreResult.h update license headers in C++ files 2019-06-19 17:02:45 -07:00