]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: implement MgrMonitor.preprocess_beacon
authorJohn Spray <john.spray@redhat.com>
Thu, 4 Aug 2016 21:07:33 +0000 (22:07 +0100)
committerJohn Spray <john.spray@redhat.com>
Thu, 29 Sep 2016 16:27:04 +0000 (17:27 +0100)
So that we're not throwing out new mgrmap epochs
every beacon.

Signed-off-by: John Spray <john.spray@redhat.com>
src/mon/MgrMonitor.cc

index 4e34edfdce99659d626506917cc65f40d99490b4..109354731b4dfcc26b5728a71edc64666209bafb 100644 (file)
@@ -98,12 +98,7 @@ bool MgrMonitor::prepare_update(MonOpRequestRef op)
   }
 }
 
-bool MgrMonitor::preprocess_beacon(MonOpRequestRef op)
-{
-  //MMgrBeacon *m = static_cast<MMgrBeacon*>(op->get_req());
 
-  return false;
-}
 
 class C_Updated : public Context {
   MgrMonitor *mm;
@@ -122,6 +117,29 @@ public:
   }
 };
 
+bool MgrMonitor::preprocess_beacon(MonOpRequestRef op)
+{
+  MMgrBeacon *m = static_cast<MMgrBeacon*>(op->get_req());
+  dout(4) << "beacon from " << m->get_gid() << dendl;
+
+  last_beacon[m->get_gid()] = ceph_clock_now(g_ceph_context);
+
+  if (pending_map.active_gid == m->get_gid()
+      && pending_map.active_addr == m->get_server_addr()
+      && pending_map.get_available() == m->get_available()) {
+    dout(4) << "Daemon already active in map" << dendl;
+    return true;
+  }
+
+  if (pending_map.standbys.count(m->get_gid()) > 0
+      && pending_map.active_gid != 0) {
+    dout(4) << "Daemon already standby in map" << dendl;
+    return true;
+  }
+
+  return false;
+}
+
 bool MgrMonitor::prepare_beacon(MonOpRequestRef op)
 {
   MMgrBeacon *m = static_cast<MMgrBeacon*>(op->get_req());