]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: fix slurp_latest to fill in any missing incrementals
authorGreg Farnum <gregory.farnum@dreamhost.com>
Tue, 28 Feb 2012 20:28:47 +0000 (12:28 -0800)
committerGreg Farnum <gregory.farnum@dreamhost.com>
Tue, 28 Feb 2012 20:29:05 +0000 (12:29 -0800)
Fixes #1789.

Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com>
src/mon/Monitor.cc
src/mon/Monitor.h

index 3554798112f9ed01bfe374dbf3f3d0ba3fcf9fc6..bfeeab9e4b378e472ee0fd53b50157e32ebb7e17 100644 (file)
@@ -674,13 +674,8 @@ void Monitor::slurp()
   bootstrap();
 }
 
-void Monitor::handle_probe_slurp(MMonProbe *m)
+MMonProbe *Monitor::fill_probe_data(MMonProbe *m, Paxos *pax)
 {
-  dout(10) << "handle_probe_slurp " << *m << dendl;
-
-  Paxos *pax = get_paxos_by_name(m->machine_name);
-  assert(pax);
-
   MMonProbe *r = new MMonProbe(monmap->fsid, MMonProbe::OP_DATA, name);
   r->machine_name = m->machine_name;
   r->oldest_version = pax->get_first_committed();
@@ -691,16 +686,26 @@ void Monitor::handle_probe_slurp(MMonProbe *m)
   for (; v <= pax->get_version(); v++) {
     len += store->get_bl_sn(r->paxos_values[m->machine_name][v], m->machine_name.c_str(), v);
     for (list<string>::iterator p = pax->extra_state_dirs.begin();
-        p != pax->extra_state_dirs.end();
-        ++p) {
+         p != pax->extra_state_dirs.end();
+         ++p) {
       len += store->get_bl_sn(r->paxos_values[*p][v], p->c_str(), v);      
     }
     if (len >= g_conf->mon_slurp_bytes)
       break;
   }
 
+  return r;
+}
+
+void Monitor::handle_probe_slurp(MMonProbe *m)
+{
+  dout(10) << "handle_probe_slurp " << *m << dendl;
+
+  Paxos *pax = get_paxos_by_name(m->machine_name);
+  assert(pax);
+
+  MMonProbe *r = fill_probe_data(m, pax);
   messenger->send_message(r, m->get_connection());
-  
   m->put();
 }
 
@@ -711,14 +716,10 @@ void Monitor::handle_probe_slurp_latest(MMonProbe *m)
   Paxos *pax = get_paxos_by_name(m->machine_name);
   assert(pax);
 
-  MMonProbe *r = new MMonProbe(monmap->fsid, MMonProbe::OP_DATA, name);
-  r->machine_name = m->machine_name;
-  r->oldest_version = pax->get_first_committed();
-  r->newest_version = pax->get_version();
+  MMonProbe *r = fill_probe_data(m, pax);
   r->latest_version = pax->get_stashed(r->latest_value);
 
   messenger->send_message(r, m->get_connection());
-  
   m->put();
 }
 
index e25ab0fcb7f0d29120e480396d35815e63af9c41..d16207b46d0c31963221629d40e47b4fcb512ed3 100644 (file)
@@ -258,6 +258,16 @@ public:
   void handle_probe_slurp(MMonProbe *m);
   void handle_probe_slurp_latest(MMonProbe *m);
   void handle_probe_data(MMonProbe *m);
+  /* Given an MMonProbe and associated Paxos machine, create a reply,
+   * fill it with the missing Paxos states and current commit pointers
+   *
+   * @param m The incoming MMonProbe. We use this to determine the range
+   * of paxos states to include in the reply.
+   * @param pax The Paxos state machine which m is associated with.
+   *
+   * @returns A new MMonProbe message, initialized as OP_DATA, and filled
+   * with the necessary Paxos states. */
+  MMonProbe *fill_probe_data(MMonProbe *m, Paxos *pax);
 
   // request routing
   struct RoutedRequest {