From f25f922b9e623a55a515699529276ecfc0045c44 Mon Sep 17 00:00:00 2001 From: Joao Eduardo Luis Date: Thu, 4 Apr 2013 18:19:02 +0100 Subject: [PATCH] mon: Monitor: convert osdmap_full as well 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 --- src/mon/Monitor.cc | 37 +++++++++++++++++++++++++++++++++++++ src/mon/Monitor.h | 1 + 2 files changed, 38 insertions(+) diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index a49d08a02af2..e3d33ce9d609 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -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; } diff --git a/src/mon/Monitor.h b/src/mon/Monitor.h index a0507142a709..f5512efd775c 100644 --- a/src/mon/Monitor.h +++ b/src/mon/Monitor.h @@ -1507,6 +1507,7 @@ public: void _convert_monitor(); void _convert_machines(string machine); + void _convert_osdmap_full(); void _convert_machines(); void _convert_paxos(); }; -- 2.47.3