osd: use ms_handle_connect to resend mon messages

This is worlds better than resending every few seconds.
This commit is contained in:
Sage Weil 2009-10-13 12:08:51 -07:00
parent bd81038006
commit b3d09e0f7d
2 changed files with 13 additions and 37 deletions

View File

@ -425,7 +425,7 @@ int OSD::init()
monc->renew_subs();
// announce to monitor i exist and have booted.
do_mon_report();
send_boot();
op_tp.start();
recovery_tp.start();
@ -1208,51 +1208,26 @@ void OSD::do_mon_report()
last_mon_report = g_clock.now();
// are prior reports still pending?
bool retry = false;
if (is_booting()) {
dout(10) << "boot still pending" << dendl;
retry = true;
}
if (osdmap->exists(whoami) &&
up_thru_pending &&
up_thru_pending < osdmap->get_up_thru(whoami)) {
dout(10) << "up_thru_pending " << up_thru_pending << " < " << osdmap->get_up_thru(whoami)
<< " -- still pending" << dendl;
retry = true;
}
pg_stat_queue_lock.Lock();
if (!pg_stat_queue.empty() || osd_stat_pending) {
dout(10) << "pg_stat_queue not empty" << dendl;
retry = true;
}
pg_stat_queue_lock.Unlock();
if (retry) {
monc->reopen_session();
dout(10) << "picked a new mon" << dendl;
}
// do any pending reports
logclient.send_log();
if (is_booting())
send_boot();
send_alive();
send_pg_temp();
send_failures();
send_pg_stats();
class_handler->resend_class_requests();
}
bool OSD::ms_handle_reset(Connection *con)
void OSD::ms_handle_connect(Connection *con)
{
dout(10) << "ms_handle_reset " << con->get_peer_addr() << dendl;
if (con->get_peer_type() == CEPH_ENTITY_TYPE_MON) {
// ...
Mutex::Locker l(osd_lock);
dout(10) << "ms_handle_connect on mon" << dendl;
if (is_booting())
send_boot();
send_alive();
send_pg_temp();
send_failures();
send_pg_stats();
class_handler->resend_class_requests();
}
return false;
}

View File

@ -815,7 +815,8 @@ protected:
private:
bool ms_dispatch(Message *m);
bool ms_handle_reset(Connection *con);
void ms_handle_connect(Connection *con);
bool ms_handle_reset(Connection *con) { return false; }
void ms_handle_remote_reset(Connection *con) {}
public: