int open(ostream &out) {
string kv_type;
int r = read_meta("kv_backend", &kv_type);
- if (r < 0 || kv_type.length() == 0)
+ if (r < 0 || kv_type.empty()) {
+ // assume old monitors that did not mark the type were leveldb.
kv_type = "leveldb";
-
+ r = write_meta("kv_backend", kv_type);
+ if (r < 0)
+ return r;
+ }
_open(kv_type);
r = db->open(out);
if (r < 0)
string kv_type;
int r = read_meta("kv_backend", &kv_type);
if (r < 0) {
- // assume old monitors that did not mark the type were leveldb.
- kv_type = "leveldb";
+ kv_type = g_conf->mon_keyvaluedb;
r = write_meta("kv_backend", kv_type);
if (r < 0)
return r;