mon: fix slurp_latest to fill in any missing incrementals

Fixes #1789.

Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com>
This commit is contained in:
Greg Farnum 2012-02-28 12:28:47 -08:00
parent 7b48cca184
commit d10e1f46df
2 changed files with 25 additions and 14 deletions

View 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();
}

View 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 {