From b3d09e0f7d4f8634b24e3c312745bc3b54381a11 Mon Sep 17 00:00:00 2001 From: Sage Weil <sage@newdream.net> Date: Tue, 13 Oct 2009 12:08:51 -0700 Subject: [PATCH] osd: use ms_handle_connect to resend mon messages This is worlds better than resending every few seconds. --- src/osd/OSD.cc | 47 +++++++++++------------------------------------ src/osd/OSD.h | 3 ++- 2 files changed, 13 insertions(+), 37 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 658790632cf..a4841a0b3ff 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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; } diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 72e97e86f66..3153af1ef31 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -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: