google / google/leveldb

How to create and destroy multiple levelDB instances in a process?

Open
#950 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
39.4k
Forks
8.2k
PR merge metrics
No merged PRs in 30d

Description

I have a file that runs a bunch of tests, each creating a levelDB instance. I have the following code in my wrapper classes destructor to clean up after each run:
```
delete db;
leveldb::Options options;
leveldb::Status status = leveldb::DestroyDB(this->path, options);
std::filesystem::remove(this->path);
if(!status.ok()) throw std::runtime_error("Could not close ledger db : " + status.ToString());
```
However, any time I try to open a new DB I get the following error:
Could not write ledger db: IO error: lock ./data/ledger/LOCK: already held by process

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.