Key size change for leveldb -
we using leveldb indexing data blocks disks , use 1 leveldb instance per disk. keys index fingerprint existing in key historical reasons (not known me) planning rid of fingerprint suffix key (as concluded can maintain uniqueness of key inode , page_offset).
the issue upgrade older version newer version, need maintain 2 indexes brief time till first index becomes free. question is, there way use same old index , change key size new key insertions , use old keys ignoring suffix part during lookups ?
please let me know if question not clear.
you can work on leveldb::options.comparator
, default leveldb::bytewisecomparatorimpl
.
example can define class named ignoresuffixcomparatorimpl :
#include "leveldb/comparator.h" class ignoresuffixcomparatorimpl : public comparator { ... virtual int compare(const slice& a, const slice& b) const { return removesuffix(a).compare(removesuffix(b)); } ... }
then, when init db, can use new comparator:
options.comparator = new ignoresuffixcomparatorimpl(); s = leveldb::db::open(options, db_path, manifest, &db);
Comments
Post a Comment