twmht / python-rocksdb

Python bindings for RocksDB
BSD 3-Clause "New" or "Revised" License
276 stars 90 forks source link

Allow `rocksdb.DB` instances to be manually closed #39

Closed fish2000 closed 5 years ago

fish2000 commented 5 years ago

While delete rocks_ptr is a deterministic operation in C++, the Python analogue del rocks_handle is not – disposal and finalization of the Rocks database are entirely dependent on the Python garbage collector (q.v. the python-rocksdb tests themselves, which call gc.collect() after del rocks_handle to attempt to force the destructor to run).

This change exposes a method to trigger the destruction of the underlying Rocks database pointer (deterministic!) through the Python Rocks handle; existing code will not need to be changed, as the Python object destructor (non-deterministic!) will now call this method.

twmht commented 5 years ago

@fish2000

Can you please solve the conflict:)

fish2000 commented 5 years ago

@twmht Hi, I posted a new PR #40, sans any merge conflicts (that is to say, it’s based on HEAD after your ColumnFamilyOptions changes).