From: Sage Weil Date: Wed, 12 Jun 2013 18:23:23 +0000 (-0700) Subject: mon: fix read of format_version out of leveldb X-Git-Tag: v0.65~93 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=862148d5fbd4bb94e49faef3a01aaf062eec7e84;p=ceph.git mon: fix read of format_version out of leveldb The get_version(string, string) is the wrong method; it combines the two args into a key that is nested inside prefix (so it's prefix/a/b), but we want perfix/format_version. Add a method to grab an int for this particular combo and use that. This fixes an infinite loop when we actually trigger this code. Bug introduced by f43c974571beac0c8e54fa699bfa96a1befaf56c. Signed-off-by: Sage Weil Reviewed-by: Joao Eduardo Luis --- diff --git a/src/mon/AuthMonitor.cc b/src/mon/AuthMonitor.cc index 1d4158f9e9d9..e4e0dacd8ba9 100644 --- a/src/mon/AuthMonitor.cc +++ b/src/mon/AuthMonitor.cc @@ -195,7 +195,7 @@ void AuthMonitor::update_from_paxos() if (last_allocated_id == 0) last_allocated_id = max_global_id; - format_version = get_version(get_service_name(), "format_version"); + format_version = get_value("format_version"); dout(10) << "update_from_paxos() last_allocated_id=" << last_allocated_id << " max_global_id=" << max_global_id diff --git a/src/mon/PaxosService.h b/src/mon/PaxosService.h index 2008dd6598ff..a49e60a6fdc6 100644 --- a/src/mon/PaxosService.h +++ b/src/mon/PaxosService.h @@ -966,6 +966,14 @@ public: int get_value(const string& key, bufferlist& bl) { return mon->store->get(get_service_name(), key, bl); } + /** + * Get an integer value from a given key. + * + * @param[in] key The key + */ + int get_value(const string& key) { + return mon->store->get(get_service_name(), key); + } /** * Get the contents of our mkfs entry *