LevelDB PUT sometimes lock
- Dominant language
- C++
- Stars
- 39.4k
- Forks
- 8.2k
- PR merge metrics
- No merged PRs in 30d
Description
My App using leveldb store some simple data. I use `kill -9` to stop the app.
sometimes command `PUT` works well; sometimes it will not.
here is the backtrace.
```
#0 __lll_lock_wait () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
#1 0x00007f0eedf66cfd in __GI___pthread_mutex_lock (mutex=0x7f0eec4b63a0) at ../nptl/pthread_mutex_lock.c:80
#2 0x00000000005f2759 in leveldb::port::Mutex::Lock() ()
#3 0x00000000005d8a40 in leveldb::DBImpl::Write(leveldb::WriteOptions const&, leveldb::WriteBatch*) ()
#4 0x00000000005d5b2a in leveldb::DB::Put(leveldb::WriteOptions const&, leveldb::Slice const&, leveldb::Slice const&) ()
#5 0x00000000005d5b79 in leveldb::DBImpl::Put(leveldb::WriteOptions const&, leveldb::Slice const&, leveldb::Slice const&) ()
#6 0x000000000058cdf5 in storage::Set (key="ReportID:1601211250000100001",
```
here is the codes:
``` c++
const int32_t kDBCacheSize = 100 * 1048576;
leveldb::DB* db = NULL;
leveldb::Options options;
const char* db_name = "./db";
options.create_if_missing = true;
options.compression = leveldb::kNoCompression;
if (!options.block_cache)
options.block_cache = leveldb::NewLRUCache(kDBCacheSize);
leveldb::Status status = leveldb::DB::Open(options, db_name, &db);
```
how can i solve this problem?
or using some code to recover the db file ?
thanks very much.
Contributor guide
Assessment
This issue has not been assessed yet.