mon: maintain stretch_recovery_triggered in new OSDMon::set_*_stretch_mode

Signed-off-by: Greg Farnum <gfarnum@redhat.com>
This commit is contained in:
Greg Farnum 2021-04-13 05:28:31 +00:00
parent e1ae9257fb
commit 73b461a4f3
3 changed files with 34 additions and 3 deletions

View File

@ -6663,6 +6663,7 @@ void Monitor::set_recovery_stretch_mode()
{
degraded_stretch_mode = true;
recovering_stretch_mode = true;
osdmon()->set_recovery_stretch_mode();
}
void Monitor::maybe_go_degraded_stretch_mode()
@ -6723,6 +6724,7 @@ void Monitor::set_degraded_stretch_mode()
{
degraded_stretch_mode = true;
recovering_stretch_mode = false;
osdmon()->set_degraded_stretch_mode();
}
struct CMonGoHealthy : public Context {
@ -6756,6 +6758,7 @@ void Monitor::set_healthy_stretch_mode()
{
degraded_stretch_mode = false;
recovering_stretch_mode = false;
osdmon()->set_healthy_stretch_mode();
}
bool Monitor::session_stretch_allowed(MonSession *s, MonOpRequestRef& op)

View File

@ -956,6 +956,8 @@ void OSDMonitor::update_from_paxos(bool *need_bootstrap)
dout(10) << "Enabling recovery stretch mode in this map" << dendl;
mon.go_recovery_stretch_mode();
}
} else {
mon.set_recovery_stretch_mode();
}
}
if (marked_osd_down &&
@ -963,9 +965,6 @@ void OSDMonitor::update_from_paxos(bool *need_bootstrap)
dout(20) << "Checking degraded stretch mode due to osd changes" << dendl;
mon.maybe_go_degraded_stretch_mode();
}
if (osdmap.recovering_stretch_mode && stretch_recovery_triggered.is_zero()) {
stretch_recovery_triggered = ceph_clock_now();
}
}
}
@ -14478,6 +14477,23 @@ void OSDMonitor::trigger_recovery_stretch_mode()
propose_pending();
}
void OSDMonitor::set_degraded_stretch_mode()
{
stretch_recovery_triggered.set_from_double(0);
}
void OSDMonitor::set_recovery_stretch_mode()
{
if (stretch_recovery_triggered.is_zero()) {
stretch_recovery_triggered = ceph_clock_now();
}
}
void OSDMonitor::set_healthy_stretch_mode()
{
stretch_recovery_triggered.set_from_double(0);
}
void OSDMonitor::notify_new_pg_digest()
{
dout(20) << __func__ << dendl;

View File

@ -827,10 +827,22 @@ public:
*/
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.)