From 5b550c0c37e1c469466a3ef0645fbb33c65866a1 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 9 Dec 2008 08:42:28 -0800 Subject: [PATCH] osd: ping mon less frequently when peerless Every second is too much. Make it tunable. --- src/config.cc | 1 + src/config.h | 1 + src/osd/OSD.cc | 11 +++++++---- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/config.cc b/src/config.cc index 097ebccbc2a03..d5d2545d4e09d 100644 --- a/src/config.cc +++ b/src/config.cc @@ -418,6 +418,7 @@ md_config_t g_conf = { osd_age: .8, osd_age_time: 0, osd_heartbeat_interval: 1, + osd_mon_heartbeat_interval: 30, // if no peers, ping monitor osd_heartbeat_grace: 60, osd_mon_report_interval: 5, // pg stats, failures, up_thru, boot. osd_replay_window: 45, diff --git a/src/config.h b/src/config.h index 6b75d68068f4a..2de072f144bf0 100644 --- a/src/config.h +++ b/src/config.h @@ -284,6 +284,7 @@ struct md_config_t { float osd_age; int osd_age_time; int osd_heartbeat_interval; + int osd_mon_heartbeat_interval; int osd_heartbeat_grace; int osd_mon_report_interval; int osd_replay_window; diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index e6b37c992ec8d..eb11c4a98ba1a 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -1125,10 +1125,13 @@ void OSD::heartbeat() // hmm.. am i all alone? if (heartbeat_from.empty() || heartbeat_to.empty()) { - dout(10) << "i have no heartbeat peers; checking mon for new map" << dendl; - int mon = monmap->pick_mon(); - messenger->send_message(new MOSDGetMap(monmap->fsid, osdmap->get_epoch()+1), - monmap->get_inst(mon)); + if (now - last_mon_heartbeat > g_conf.osd_mon_heartbeat_interval) { + last_mon_heartbeat = now; + dout(10) << "i have no heartbeat peers; checking mon for new map" << dendl; + int mon = monmap->pick_mon(); + messenger->send_message(new MOSDGetMap(monmap->fsid, osdmap->get_epoch()+1), + monmap->get_inst(mon)); + } } if (map_locked) -- 2.39.5