diff options
author | Sage Weil <sage@inktank.com> | 2013-07-21 17:16:10 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-07-21 17:16:10 -0700 |
commit | c4193013d5e6fdf480fa9e9b14fec5c748c7f87d (patch) | |
tree | f65f1eea44d5ec7cf95efd9ee15f125f3a28ee11 /src/mon/OSDMonitor.cc | |
parent | 6d386bda93099dc2e450cde7139487b5983f8889 (diff) | |
parent | 73b4003f6545ae1ed9efd3abc3b25bd3ebd73c46 (diff) | |
download | ceph-wip-5672.tar.gz |
Merge remote-tracking branch 'gh/next' into wip-5672wip-5672
Diffstat (limited to 'src/mon/OSDMonitor.cc')
-rw-r--r-- | src/mon/OSDMonitor.cc | 98 |
1 files changed, 29 insertions, 69 deletions
diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index c8baac58c83..20e4eac88cb 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -185,8 +185,11 @@ void OSDMonitor::update_from_paxos(bool *need_bootstrap) mon->pgmon()->check_osd_map(osdmap.epoch); } - update_logger(); + check_subs(); + share_map_with_random_osd(); + update_logger(); + process_failures(); // make sure our feature bits reflect the latest map @@ -294,9 +297,6 @@ void OSDMonitor::on_active() { update_logger(); - send_to_waiting(); - check_subs(); - if (thrash_map) { if (mon->is_leader()) { if (thrash()) @@ -310,22 +310,25 @@ void OSDMonitor::on_active() mon->clog.info() << "osdmap " << osdmap << "\n"; if (!mon->is_leader()) { - kick_all_failures(); + list<MOSDFailure*> ls; + take_all_failures(ls); + while (!ls.empty()) { + dispatch(ls.front()); + ls.pop_front(); + } } } 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++); + + // discard failure info, waiters + list<MOSDFailure*> ls; + take_all_failures(ls); + while (!ls.empty()) { + ls.front()->put(); + ls.pop_front(); } } @@ -1049,23 +1052,16 @@ void OSDMonitor::process_failures() } } -void OSDMonitor::kick_all_failures() +void OSDMonitor::take_all_failures(list<MOSDFailure*>& ls) { - dout(10) << "kick_all_failures on " << failure_info.size() << " osds" << dendl; - assert(!mon->is_leader()); + dout(10) << __func__ << " on " << failure_info.size() << " osds" << dendl; - list<MOSDFailure*> ls; for (map<int,failure_info_t>::iterator p = failure_info.begin(); p != failure_info.end(); ++p) { p->second.take_report_messages(ls); } failure_info.clear(); - - while (!ls.empty()) { - dispatch(ls.front()); - ls.pop_front(); - } } @@ -1311,7 +1307,6 @@ void OSDMonitor::_reply_map(PaxosServiceMessage *m, epoch_t e) { dout(7) << "_reply_map " << e << " from " << m->get_orig_source_inst() - << " for " << m << dendl; send_latest(m, e); } @@ -1450,53 +1445,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(); } @@ -1651,6 +1608,7 @@ epoch_t OSDMonitor::blacklist(const entity_addr_t& a, utime_t until) void OSDMonitor::check_subs() { + dout(10) << __func__ << dendl; string type = "osdmap"; if (mon->session_map.subs.count(type) == 0) return; @@ -1664,6 +1622,8 @@ void OSDMonitor::check_subs() void OSDMonitor::check_sub(Subscription *sub) { + dout(10) << __func__ << " " << sub << " next " << sub->next + << (sub->onetime ? " (onetime)":" (ongoing)") << dendl; if (sub->next <= osdmap.get_epoch()) { if (sub->next >= 1) send_incremental(sub->next, sub->session->inst, sub->incremental_onetime); |