Skip to content

Commit

Permalink
mon: implement MgrMonitor.preprocess_beacon
Browse files Browse the repository at this point in the history
So that we're not throwing out new mgrmap epochs
every beacon.

Signed-off-by: John Spray <john.spray@redhat.com>
  • Loading branch information
John Spray committed Aug 4, 2016
1 parent ced9d3f commit 0a551ad
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions src/mon/MgrMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -122,6 +117,29 @@ class C_Updated : public Context {
}
};

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());
Expand Down

0 comments on commit 0a551ad

Please sign in to comment.