]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: Monitor: convert osdmap_full as well 220/head 221/head
authorJoao Eduardo Luis <joao.luis@inktank.com>
Thu, 4 Apr 2013 17:19:02 +0000 (18:19 +0100)
committerJoao Eduardo Luis <joao.luis@inktank.com>
Wed, 17 Apr 2013 21:17:51 +0000 (22:17 +0100)
Store conversion wasn't converting the osdmap_full/ versions, only the
incrementals under osdmap/ and the latest full version stashed.  This
would lead to some serious problems during OSDMonitor's update_from_paxos
when the latest stashed didn't correspond to the first available
incremental.

Fixes: #4521
Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
src/mon/Monitor.cc
src/mon/Monitor.h

index a49d08a02af215a640124a27f181db6d7eacbc78..e3d33ce9d60987c02d072d1ac0696493db679805 100644 (file)
@@ -4332,6 +4332,37 @@ out:
   dout(10) << __func__ << " machine " << machine << " finished" << dendl;
 }
 
+void Monitor::StoreConverter::_convert_osdmap_full()
+{
+  dout(10) << __func__ << dendl;
+  version_t first_committed =
+    store->get_int("osdmap", "first_committed");
+  version_t last_committed =
+    store->get_int("osdmap", "last_committed");
+
+  int err = 0;
+  for (version_t ver = first_committed; ver <= last_committed; ver++) {
+    if (!store->exists_bl_sn("osdmap_full", ver)) {
+      dout(20) << __func__ << " osdmap_full  ver " << ver << " dne" << dendl;
+      err++;
+      continue;
+    }
+
+    bufferlist bl;
+    int r = store->get_bl_sn(bl, "osdmap_full", ver);
+    assert(r >= 0);
+    dout(20) << __func__ << " osdmap_full ver " << ver
+             << " bl " << bl.length() << " bytes" << dendl;
+
+    string full_key = "full_" + stringify(ver);
+    MonitorDBStore::Transaction tx;
+    tx.put("osdmap", full_key, bl);
+    db->apply_transaction(tx);
+  }
+  dout(10) << __func__ << " found " << err << " conversion errors!" << dendl;
+  assert(err == 0);
+}
+
 void Monitor::StoreConverter::_convert_paxos()
 {
   dout(10) << __func__ << dendl;
@@ -4384,5 +4415,11 @@ void Monitor::StoreConverter::_convert_machines()
   for (; it != machine_names.end(); ++it) {
     _convert_machines(*it);
   }
+  // convert osdmap full versions
+  // this stays here as these aren't really an independent paxos
+  // machine, but rather machine-specific and don't fit on the
+  // _convert_machines(string) function.
+  _convert_osdmap_full();
+
   dout(10) << __func__ << " finished" << dendl;
 }
index a0507142a709d549b9b7c1685c8f31d3ff9f2195..f5512efd775c47246810175de7f6e2cd443af16e 100644 (file)
@@ -1507,6 +1507,7 @@ public:
 
     void _convert_monitor();
     void _convert_machines(string machine);
+    void _convert_osdmap_full();
     void _convert_machines();
     void _convert_paxos();
   };