+11.0.0
+------
+
+* If you have manually specified the monitor user rocksdb via the
+ ``mon keyvaluedb = rocksdb`` option, you will need to manually add a file
+ to the mon data directory to preserve this option::
+
+ echo rocksdb > /var/lib/ceph/mon/ceph-`hostname`/kv_backend
+
+ New monitors will now use rocksdb by default, but if that file is
+ not present, existing monitors will use leveldb. The ``mon keyvaluedb`` option
+ now only affects the backend chosen when a monitor is created.
assert(r >= 0);
}
- void _open() {
+ void _open(string kv_type) {
string::const_reverse_iterator rit;
int pos = 0;
for (rit = path.rbegin(); rit != path.rend(); ++rit, ++pos) {
string full_path = os.str();
KeyValueDB *db_ptr = KeyValueDB::create(g_ceph_context,
- g_conf->mon_keyvaluedb,
+ kv_type,
full_path);
if (!db_ptr) {
derr << __func__ << " error initializing "
- << g_conf->mon_keyvaluedb << " db back storage in "
+ << kv_type << " db back storage in "
<< full_path << dendl;
assert(0 != "MonitorDBStore: error initializing keyvaluedb back storage");
}
}
do_dump = true;
}
- if (g_conf->mon_keyvaluedb == "rocksdb")
+ if (kv_type == "rocksdb")
db->init(g_conf->mon_rocksdb_options);
else
db->init();
}
int open(ostream &out) {
- _open();
- int r = db->open(out);
+ string kv_type;
+ int r = read_meta("kv_backend", &kv_type);
+ if (r < 0 || kv_type.length() == 0)
+ kv_type = "leveldb";
+
+ _open(kv_type);
+ r = db->open(out);
if (r < 0)
return r;
io_work.start();
}
int create_and_open(ostream &out) {
- _open();
- int r = db->create_and_open(out);
+ // record the type before open
+ string kv_type;
+ int r = read_meta("kv_backend", &kv_type);
+ if (r < 0) {
+ kv_type = g_conf->mon_keyvaluedb;
+ r = write_meta("kv_backend", kv_type);
+ if (r < 0)
+ return r;
+ }
+ _open(kv_type);
+ r = db->create_and_open(out);
if (r < 0)
return r;
io_work.start();