google / leveldb

LevelDB is a fast key-value storage library written at Google that provides an ordered mapping from string keys to string values.
BSD 3-Clause "New" or "Revised" License
36.66k stars 7.84k forks source link

CompactRange(): Try to remove non existing ldb files #573

Open MathieuCassagne opened 6 years ago

MathieuCassagne commented 6 years ago

Hi !

When running a strace on my project, I observed that LevelDB try to delete ldb files that doesn't exists each time I use CompactRange().

Here is a sample of code that trigger the issue.

#include <cassert>
#include "leveldb/db.h"

int main(void) {
  leveldb::DB* db;
  leveldb::Options options;
  options.create_if_missing = true;
  leveldb::Status status = leveldb::DB::Open(options, "/tmp/testdb", &db);
  assert(status.ok());
  db->CompactRange(NULL, NULL);
}

When running it with "strace -f" I catch this line:

...
[pid 31575] unlink("/tmp/testdb/000005.ldb") = -1 ENOENT (No such file or directory)
...

I mainly wanted to know if it is a wanted/normal behaviour of a compaction, as it doesn't seems to happen when it is a not forced compaction.

Cheers !

MathieuCassagne commented 6 years ago

Hey !

I'm still struggling with that topics, any ideas ? :)

Cheers !