leo-project / erocksdb

Erlang bindings to RocksDB datastore
68 stars 15 forks source link

DB catalogs structure #43

Open a-pashkov opened 5 years ago

a-pashkov commented 5 years ago

Hello,

Then I tried to open database wich was created by eleveldb I see this: 1>erocksdb:open("./data/leveldb_data/45671926166590716193865151022383844364247891968", [{create_if_missing,true}, {write_buffer_size,32341453}], []). {error,{db_open,"Corruption: Can't access /008039.sst: IO error: ./data/leveldb_data/45671926166590716193865151022383844364247891968/008039.sst: No such file or directory...

eleveldb directory looks like this: ./data/leveldb_data/45671926166590716193865151022383844364247891968 ├── 008037.log ├── CURRENT ├── IDENTITY ├── LOCK ├── LOG ├── LOG.old.1566577075266246 ├── LOG.old.1566577091506941 ├── LOG.old.1566638213937366 ├── LOG.old.1566638221253093 ├── MANIFEST-000002 ├── sst_0 ├── sst_1 │   ├── 007980.sst │   ├── 008021.sst │   ├── 008030.sst │   └── 008039.sst ├── sst_2 │   ├── 007979.sst │   ├── 007981.sst │   ├── 007982.sst ...

How to open databases which stored data in basho style subfolders sst_0, sst_1...

mocchira commented 5 years ago

@a-pashkov erocksdb is built for rocksdb NOT for leveldb. I'd recommend you use https://github.com/basho/eleveldb instead.

a-pashkov commented 5 years ago

@mocchira my aim was to change backend from eleveldb to erocksdb with storage of existing data.

leveldb and rocksdb have same data structure but basho updated the leveldb code to place .sst tables file into subdirectories that represented the "level" of the file, i.e. sst_0, sst_1, … sst_6.

Please advise if the erocksdb has an opportunity for the same behaviour?

mocchira commented 5 years ago

@a-pashkov AFAIK, the file formats of rocksdb are not compatible with leveldb's ones so that means it's impossible to deal with existing leveldb files through erocksdb even if we manage to solve the different directory structure problem "How to open databases which stored data in basho style subfolders sst_0, sst_1..." somehow.

Can I ask you that why would you try to use erocksdb for existing leveldb files instead of eleveldb?

a-pashkov commented 5 years ago

@mocchira We have some problems with leveldb when we use dirty schedulers.

I tried to open leveldb's base in erocksdb and it works. (in this direction) 1> {ok, Db} = eleveldb:open("./tmp/test", [{create_if_missing,true}]). {ok,<<>>} 2> eleveldb:put(Db, <<"1">>, <<"aaa">>, []). ok 3> eleveldb:get(Db, <<"1">>, []). {ok,<<"aaa">>} 4> eleveldb:close(Db). ok 5> 5> {ok, Db1} = erocksdb:open("./tmp/test", [], []). {ok,<<>>} 6> erocksdb:get(Db1, <<"1">>, []). {ok,<<"aaa">>} 7> erocksdb:put(Db1, <<"1">>, <<"bbb">>, []). ok 8> erocksdb:get(Db1, <<"1">>, []). {ok,<<"bbb">>} 9> erocksdb:close(Db1). ok