]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: note mds beacon times more carefully
authorSage Weil <sage@newdream.net>
Fri, 12 Feb 2010 21:35:57 +0000 (13:35 -0800)
committerSage Weil <sage@newdream.net>
Fri, 12 Feb 2010 21:35:57 +0000 (13:35 -0800)
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
src/mon/MDSMonitor.h

index bdb8b4e4cb5bf987a186980094ed06a617bc9c83..60a238997b752fc528e1799a6d3d1b0000e85552 100644 (file)
@@ -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;
index 4a14f9be200e0f7c6c162c851e9097ab5e069bf7..4765545056f45bf3d67c0aaa4a5fb7d4bf071fdc 100644 (file)
@@ -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);