summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-07-19 16:35:02 -0700
committerSage Weil <sage@inktank.com>2013-07-19 16:39:49 -0700
commite4f2e3ecd0aee8f30005f915595271c5ae2149cb (patch)
tree0dd2d4c6c70da9036e2b9c1b54b9e6eab5da8b66
parent6edec516bf82f2c6d622a5485a4eca7b0959d3d7 (diff)
downloadceph-e4f2e3ecd0aee8f30005f915595271c5ae2149cb.tar.gz
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 <sage@inktank.com>
-rw-r--r--src/mon/OSDMonitor.cc63
-rw-r--r--src/mon/OSDMonitor.h3
2 files changed, 7 insertions, 59 deletions
diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc
index 95bd72c0b58..82ff36d8469 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<epoch_t, list<PaxosServiceMessage*> >::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<epoch_t, list<PaxosServiceMessage*> >::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 d6553228321..dda2374d7e8 100644
--- a/src/mon/OSDMonitor.h
+++ b/src/mon/OSDMonitor.h
@@ -118,8 +118,6 @@ public:
OSDMap osdmap;
private:
- map<epoch_t, list<PaxosServiceMessage*> > waiting_for_map;
-
// [leader]
OSDMap::Incremental pending_inc;
map<int, failure_info_t> 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);