} else if (pending_map.active_gid == 0) {
// There is no currently active daemon, select this one.
if (pending_map.standbys.count(m->get_gid())) {
- drop_standby(m->get_gid());
+ drop_standby(m->get_gid(), false);
}
dout(4) << "selecting new active " << m->get_gid()
<< " " << m->get_name()
pending_map.available = false;
pending_map.active_addr = entity_addr_t();
- drop_standby(replacement_gid);
+ drop_standby(replacement_gid, false);
+
return true;
} else {
return false;
cancel_timer();
}
-void MgrMonitor::drop_standby(uint64_t gid)
+void MgrMonitor::drop_standby(uint64_t gid, bool drop_meta)
{
- pending_metadata_rm.insert(pending_map.standbys[gid].name);
- pending_metadata.erase(pending_map.standbys[gid].name);
+ if (drop_meta) {
+ pending_metadata_rm.insert(pending_map.standbys[gid].name);
+ pending_metadata.erase(pending_map.standbys[gid].name);
+ }
pending_map.standbys.erase(gid);
if (last_beacon.count(gid) > 0) {
last_beacon.erase(gid);
*/
bool promote_standby();
void drop_active();
- void drop_standby(uint64_t gid);
+
+ /**
+ * Remove this gid from the list of standbys. By default,
+ * also remove metadata (i.e. forget the daemon entirely).
+ *
+ * Set `drop_meta` to false if you would like to keep
+ * the daemon's metadata, for example if you're dropping
+ * it as a standby before reinstating it as the active daemon.
+ */
+ void drop_standby(uint64_t gid, bool drop_meta=true);
Context *digest_event = nullptr;
void cancel_timer();