From: Sage Weil Date: Fri, 19 Jul 2013 23:35:02 +0000 (-0700) Subject: mon/OSDMonitor: do not wait for readable in send_latest() X-Git-Tag: v0.67-rc1~12^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e4f2e3ecd0aee8f30005f915595271c5ae2149cb;p=ceph.git mon/OSDMonitor: do not wait for readable in send_latest() send_latest() checks for readable and, if untrue, will wait before sending out the latest OSDMap. This is completely unnecessary; I think it is a hold-over from when we have independent paxos states. An audit of all callers confirms that everyone would be happy with whatever is committed, even if we are in the process of committing an even newer version. Effectively, everyone waits *above* this layer in the usual PaxosService traps for whether we are readable or not. This means that waiting_for_map and send_to_waiting() go away entirely, which is nice. This addresses, among other things: send_to_waiting() is called from update_from_paxos(), which can be called when we are not readable due to the paxos commit/finish timing changes in f1ce8d7c955a24 and c711203c0d4b. If no subsequent update happens, those waiters never get their maps. Instead, we send them immediately--we know they are committed and old history is as good as future history. Fixes: #5643 Signed-off-by: Sage Weil --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 95bd72c0b58e..82ff36d8469c 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -185,7 +185,6 @@ void OSDMonitor::update_from_paxos(bool *need_bootstrap) mon->pgmon()->check_osd_map(osdmap.epoch); } - send_to_waiting(); check_subs(); share_map_with_random_osd(); @@ -312,16 +311,6 @@ void OSDMonitor::on_active() void OSDMonitor::on_shutdown() { dout(10) << __func__ << dendl; - map >::iterator p = waiting_for_map.begin(); - while (p != waiting_for_map.end()) { - while (!p->second.empty()) { - Message *m = p->second.front(); - dout(20) << " discarding " << m << " " << *m << dendl; - m->put(); - p->second.pop_front(); - } - waiting_for_map.erase(p++); - } } void OSDMonitor::update_logger() @@ -1444,53 +1433,15 @@ bool OSDMonitor::prepare_remove_snaps(MRemoveSnaps *m) // --------------- // map helpers -void OSDMonitor::send_to_waiting() -{ - dout(10) << "send_to_waiting " << osdmap.get_epoch() << dendl; - - map >::iterator p = waiting_for_map.begin(); - while (p != waiting_for_map.end()) { - epoch_t from = p->first; - - if (from) { - if (from <= osdmap.get_epoch()) { - while (!p->second.empty()) { - send_incremental(p->second.front(), from); - p->second.front()->put(); - p->second.pop_front(); - } - } else { - dout(10) << "send_to_waiting from " << from << dendl; - ++p; - continue; - } - } else { - while (!p->second.empty()) { - send_full(p->second.front()); - p->second.front()->put(); - p->second.pop_front(); - } - } - - waiting_for_map.erase(p++); - } -} - void OSDMonitor::send_latest(PaxosServiceMessage *m, epoch_t start) { - if (is_readable()) { - dout(5) << "send_latest to " << m->get_orig_source_inst() - << " start " << start << dendl; - if (start == 0) - send_full(m); - else - send_incremental(m, start); - m->put(); - } else { - dout(5) << "send_latest to " << m->get_orig_source_inst() - << " start " << start << " later" << dendl; - waiting_for_map[start].push_back(m); - } + dout(5) << "send_latest to " << m->get_orig_source_inst() + << " start " << start << dendl; + if (start == 0) + send_full(m); + else + send_incremental(m, start); + m->put(); } diff --git a/src/mon/OSDMonitor.h b/src/mon/OSDMonitor.h index d65532283210..dda2374d7e88 100644 --- a/src/mon/OSDMonitor.h +++ b/src/mon/OSDMonitor.h @@ -118,8 +118,6 @@ public: OSDMap osdmap; private: - map > waiting_for_map; - // [leader] OSDMap::Incremental pending_inc; map failure_info; @@ -192,7 +190,6 @@ private: bool can_mark_in(int o); // ... - void send_to_waiting(); // send current map to waiters. MOSDMap *build_latest_full(); MOSDMap *build_incremental(epoch_t first, epoch_t last); void send_full(PaxosServiceMessage *m);