From 025bce64f42d22e971aa305e1981b14350d600d4 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 2 Aug 2010 13:12:29 -0700 Subject: [PATCH] osd: send heartbeat request from update_heartbeat_peers This keeps our from_stamps in a consistent state, and sends the hb request sooner rather than later. Signed-off-by: Sage Weil --- src/osd/OSD.cc | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index f6e9e0843a10..acd83572a6d6 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -1167,6 +1167,10 @@ void OSD::update_heartbeat_peers() old_from.swap(heartbeat_from); old_inst.swap(heartbeat_inst); + utime_t now = g_clock.now(); + + heartbeat_epoch = osdmap->get_epoch(); + // build heartbeat to/from set for (hash_map::iterator i = pg_map.begin(); i != pg_map.end(); @@ -1195,6 +1199,10 @@ void OSD::update_heartbeat_peers() heartbeat_from_stamp[p] = old_from_stamp[p]; } else { dout(10) << "update_heartbeat_peers: new _from osd" << p << " " << heartbeat_inst[p] << dendl; + heartbeat_from_stamp[p] = now; + MOSDPing *m = new MOSDPing(osdmap->get_fsid(), 0, heartbeat_epoch, my_stat, true); // request hb + m->set_priority(CEPH_MSG_PRIO_HIGH); + heartbeat_messenger->send_message(m, heartbeat_inst[p]); } } } @@ -1224,8 +1232,6 @@ void OSD::update_heartbeat_peers() << " " << old_inst[p->first] << dendl; } - heartbeat_epoch = osdmap->get_epoch(); - dout(10) << "update_heartbeat_peers: hb to: " << heartbeat_to << dendl; dout(10) << "update_heartbeat_peers: hb from: " << heartbeat_from << dendl; @@ -1389,20 +1395,6 @@ void OSD::heartbeat() } } - // request heartbeats? - for (map::iterator p = heartbeat_from.begin(); - p != heartbeat_from.end(); - p++) { - if (heartbeat_from_stamp.count(p->first) == 0) { - // fake initial stamp. and send them a ping so they know we expect it. - dout(10) << "requesting heartbeats from " << heartbeat_inst[p->first] << dendl; - heartbeat_from_stamp[p->first] = now; - Message *m = new MOSDPing(osdmap->get_fsid(), 0, heartbeat_epoch, my_stat, true); // request ack - m->set_priority(CEPH_MSG_PRIO_HIGH); - heartbeat_messenger->send_message(m, heartbeat_inst[p->first]); - } - } - if (map_locked) heartbeat_check(); -- 2.47.3