Open aramallo opened 10 months ago
So far I managed to use the same technique you are using on the C bindings. That is, I create a struct to keep track of the handles created with DBInstance.new and allow the user to call close(id)
which removes the handle and thus Rust destroys the instance. The issue still is that engines like RocksDB will take some time to tear down which might lead to a race condition when immediately tryin to re-open the same database (as the rocksdb files are locked).
So it would be nice to have a close function that waits for RocksDB termination.
so that's what's been happening to me!
I have a development server that is restarts on any change to the code and it has worked beautifully for me for a while now, no lock errors.
But then I wrote some tests, and the tester in watch mode destroys and then creates the DB in quick succession and often it blows up on not being able to achieve a lock on the file.
It would be great if it was a promise that resolves after everything is actually closed.
Can confirm this issue - my tests end up reopening the same database a few times in a row (specifically to test behavior of my code on initialization), and I kept getting lock errors. For some reason though, adding an explicit drop()
call right before the init calls seems to have been enough - at least for now?
+1 for a close()
call!
Hi,
I am building an Erlang binding using the Rust library.
At the moment I am creating an instance using
DbInstance::new
to open a database, but there is no function to close the instance. How can I close a database?