From f5209d750c8129c608d7c62d49fe0b1e33a59b6c Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 12 Feb 2010 13:35:57 -0800 Subject: [PATCH] mon: note mds beacon times more carefully We need to update the beacon timestamp even when we are updating the mds state. Otherwise we can get caught in a busy loop between marking an mds laggy and !laggy because the beacon stamp never updates. So even if we are updating, and the reply will be slow, update our timestamp, so we don't mark the mds laggy. --- src/mon/MDSMonitor.cc | 19 ++++++++++++++----- src/mon/MDSMonitor.h | 1 + 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index bdb8b4e4cb5bf..60a238997b752 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -140,6 +140,16 @@ bool MDSMonitor::preprocess_query(PaxosServiceMessage *m) } } +void MDSMonitor::_note_beacon(MMDSBeacon *m) +{ + __u64 gid = m->get_global_id(); + version_t seq = m->get_seq(); + + dout(15) << "_note_beacon " << *m << " noting time" << dendl; + last_beacon[gid].stamp = g_clock.now(); + last_beacon[gid].seq = seq; +} + bool MDSMonitor::preprocess_beacon(MMDSBeacon *m) { entity_addr_t addr = m->get_orig_source_inst().addr; @@ -186,6 +196,7 @@ bool MDSMonitor::preprocess_beacon(MMDSBeacon *m) } if (info.laggy()) { + _note_beacon(m); return false; // no longer laggy, need to update map. } if (state == MDSMap::STATE_BOOT) { @@ -209,19 +220,17 @@ bool MDSMonitor::preprocess_beacon(MMDSBeacon *m) dout(10) << "mds_beacon can't standby-replay mds" << info.rank << " at this time (cluster degraded, or mds not active)" << dendl; goto ignore; } - + _note_beacon(m); return false; // need to update map } ignore: // note time and reply - dout(15) << "mds_beacon " << *m << " noting time and replying" << dendl; - last_beacon[gid].stamp = g_clock.now(); - last_beacon[gid].seq = seq; + _note_beacon(m); mon->send_reply(m, new MMDSBeacon(mon->monmap->fsid, m->get_global_id(), m->get_name(), mdsmap.get_epoch(), state, seq)); - + // done out: delete m; diff --git a/src/mon/MDSMonitor.h b/src/mon/MDSMonitor.h index 4a14f9be200e0..4765545056f45 100644 --- a/src/mon/MDSMonitor.h +++ b/src/mon/MDSMonitor.h @@ -76,6 +76,7 @@ class MDSMonitor : public PaxosService { void committed(); + void _note_beacon(class MMDSBeacon *m); bool preprocess_beacon(class MMDSBeacon *m); bool prepare_beacon(class MMDSBeacon *m); -- 2.39.5