MonOpRequestRef op; ///< failure op request
failure_reporter_t() {}
- explicit failure_reporter_t(utime_t s) : failed_since(s) {}
+ failure_reporter_t(utime_t s, MonOpRequestRef op)
+ : failed_since(s), op(op) {}
~failure_reporter_t() { }
};
return max_failed_since;
}
- // set the message for the latest report. return any old op request we had,
- // if any, so we can discard it.
- MonOpRequestRef add_report(int who, utime_t failed_since,
- MonOpRequestRef op) {
- auto p = reporters.find(who);
- if (p == reporters.end()) {
- if (max_failed_since != utime_t() && max_failed_since < failed_since)
+ // set the message for the latest report.
+ void add_report(int who, utime_t failed_since, MonOpRequestRef op) {
+ [[maybe_unused]] auto [it, new_reporter] =
+ reporters.insert_or_assign(who, failure_reporter_t{failed_since, op});
+ if (new_reporter) {
+ if (max_failed_since != utime_t() && max_failed_since < failed_since) {
max_failed_since = failed_since;
- p = reporters.insert(std::map<int, failure_reporter_t>::value_type(who, failure_reporter_t(failed_since))).first;
+ }
}
-
- MonOpRequestRef ret = p->second.op;
- p->second.op = op;
- return ret;
}
void take_report_messages(std::list<MonOpRequestRef>& ls) {
}
}
- MonOpRequestRef cancel_report(int who) {
- auto p = reporters.find(who);
- if (p == reporters.end())
- return MonOpRequestRef();
- MonOpRequestRef ret = p->second.op;
- reporters.erase(p);
+ void cancel_report(int who) {
+ reporters.erase(who);
max_failed_since = utime_t();
- return ret;
}
};
bool check_failures(utime_t now);
bool check_failure(utime_t now, int target_osd, failure_info_t& fi);
+ utime_t get_grace_time(utime_t now, int target_osd, failure_info_t& fi) const;
+ bool is_failure_stale(utime_t now, failure_info_t& fi) const;
void force_failure(int target_osd, int by);
bool _have_pending_crush();
*/
void trigger_degraded_stretch_mode(const set<int>& dead_buckets,
const set<string>& live_zones);
+ /**
+ * This is just to maintain stretch_recovery_triggered; below
+ */
+ void set_degraded_stretch_mode();
/**
* Set recovery stretch mode in the OSDMap, resetting pool size back to normal
*/
void trigger_recovery_stretch_mode();
+ /**
+ * This is just to maintain stretch_recovery_triggered; below
+ */
+ void set_recovery_stretch_mode();
+ /**
+ * This is just to maintain stretch_recovery_triggered; below
+ */
+ void set_healthy_stretch_mode();
/**
* Tells the OSD there's a new pg digest, in case it's interested.
* (It's interested when in recovering stretch mode.)