Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/common/options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4413,12 +4413,18 @@ std::vector<Option> get_global_options() {
.set_description("Rocksdb options"),

Option("bluestore_rocksdb_cf", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(false)
.set_default(true)
.set_description("Enable use of rocksdb column families for bluestore metadata"),

Option("bluestore_rocksdb_cfs", Option::TYPE_STR, Option::LEVEL_DEV)
.set_default("M= P= L=")
.set_description("List of whitespace-separate key/value pairs where key is CF name and value is CF options"),
.set_default("m(3) O(3,0-13) L")
.set_description("Definition of column families and their sharding")
.set_long_description("Space separated list of elements: column_def [ '=' rocksdb_options ]. "
"column_def := column_name [ '(' shard_count [ ',' hash_begin '-' [ hash_end ] ] ')' ]. "
"Example: 'I=write_buffer_size=1048576 O(6) m(7,10-)'. "
"Interval [hash_begin..hash_end) defines characters to use for hash calculation. "
"Recommended hash ranges: O(0-13) P(0-8) m(0-16). "
"Sharding of S,T,C,M,B prefixes is inadvised"),

Option("bluestore_fsck_on_mount", Option::TYPE_BOOL, Option::LEVEL_DEV)
.set_default(false)
Expand Down
29 changes: 3 additions & 26 deletions src/kv/KeyValueDB.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,6 @@
*/
class KeyValueDB {
public:
/*
* See RocksDB's definition of a column family(CF) and how to use it.
* The interfaces of KeyValueDB is extended, when a column family is created.
* Prefix will be the name of column family to use.
*/
struct ColumnFamily {
std::string name; //< name of this individual column family
std::string option; //< configure option string for this CF
ColumnFamily(const std::string &name, const std::string &option)
: name(name), option(option) {}
};

class TransactionImpl {
public:
/// Set Keys
Expand Down Expand Up @@ -155,12 +143,11 @@ class KeyValueDB {
/// test whether we can successfully initialize; may have side effects (e.g., create)
static int test_init(const std::string& type, const std::string& dir);
virtual int init(std::string option_str="") = 0;
virtual int open(std::ostream &out, const std::vector<ColumnFamily>& cfs = {}) = 0;
virtual int open(std::ostream &out, const std::string& cfs="") = 0;
// std::vector cfs contains column families to be created when db is created.
virtual int create_and_open(std::ostream &out,
const std::vector<ColumnFamily>& cfs = {}) = 0;
virtual int create_and_open(std::ostream &out, const std::string& cfs="") = 0;

virtual int open_read_only(std::ostream &out, const std::vector<ColumnFamily>& cfs = {}) {
virtual int open_read_only(std::ostream &out, const std::string& cfs="") {
return -ENOTSUP;
}

Expand Down Expand Up @@ -333,14 +320,6 @@ class KeyValueDB {
get_wholespace_iterator());
}

void add_column_family(const std::string& cf_name, void *handle) {
cf_handles.insert(std::make_pair(cf_name, handle));
}

bool is_column_family(const std::string& prefix) {
return cf_handles.count(prefix);
}

virtual uint64_t get_estimated_size(std::map<std::string,uint64_t> &extra) = 0;
virtual int get_statfs(struct store_statfs_t *buf) {
return -EOPNOTSUPP;
Expand Down Expand Up @@ -438,8 +417,6 @@ class KeyValueDB {
std::vector<std::pair<std::string,
std::shared_ptr<MergeOperator> > > merge_ops;

/// column families in use, name->handle
std::unordered_map<std::string, void *> cf_handles;
};

#endif
4 changes: 2 additions & 2 deletions src/kv/LevelDBStore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ int LevelDBStore::init(string option_str)
return 0;
}

int LevelDBStore::open(ostream &out, const vector<ColumnFamily>& cfs) {
int LevelDBStore::open(ostream &out, const std::string& cfs) {
if (!cfs.empty()) {
ceph_abort_msg("Not implemented");
}
return do_open(out, false);
}

int LevelDBStore::create_and_open(ostream &out, const vector<ColumnFamily>& cfs) {
int LevelDBStore::create_and_open(ostream &out, const std::string& cfs) {
if (!cfs.empty()) {
ceph_abort_msg("Not implemented");
}
Expand Down
4 changes: 2 additions & 2 deletions src/kv/LevelDBStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ class LevelDBStore : public KeyValueDB {
int init(std::string option_str="") override;

/// Opens underlying db
int open(std::ostream &out, const std::vector<ColumnFamily>& = {}) override;
int open(std::ostream &out, const std::string& cfs="") override;
/// Creates underlying db if missing and opens it
int create_and_open(std::ostream &out, const std::vector<ColumnFamily>& = {}) override;
int create_and_open(std::ostream &out, const std::string& cfs="") override;

void close() override;

Expand Down
4 changes: 2 additions & 2 deletions src/kv/MemDB.cc
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,14 @@ int MemDB::do_open(ostream &out, bool create)
return _init(create);
}

int MemDB::open(ostream &out, const vector<ColumnFamily>& cfs) {
int MemDB::open(ostream &out, const std::string& cfs) {
if (!cfs.empty()) {
ceph_abort_msg("Not implemented");
}
return do_open(out, false);
}

int MemDB::create_and_open(ostream &out, const vector<ColumnFamily>& cfs) {
int MemDB::create_and_open(ostream &out, const std::string& cfs) {
if (!cfs.empty()) {
ceph_abort_msg("Not implemented");
}
Expand Down
4 changes: 2 additions & 2 deletions src/kv/MemDB.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ class MemDB : public KeyValueDB
int _init(bool format);

int do_open(std::ostream &out, bool create);
int open(std::ostream &out, const std::vector<ColumnFamily>&) override;
int create_and_open(std::ostream &out, const std::vector<ColumnFamily>&) override;
int open(std::ostream &out, const std::string& cfs="") override;
int create_and_open(std::ostream &out, const std::string& cfs="") override;
using KeyValueDB::create_and_open;

KeyValueDB::Transaction get_transaction() override {
Expand Down
Loading