mirror of
https://github.com/ceph/ceph
synced 2024-12-17 17:05:42 +00:00
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 inf1ce8d7c95
andc711203c0d
. 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>
This commit is contained in:
parent
6edec516bf
commit
e4f2e3ecd0
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user