Skip to content

Commit

Permalink
mon: maintain stretch_recovery_triggered in new OSDMon::set_*_stretch…
Browse files Browse the repository at this point in the history
…_mode

Signed-off-by: Greg Farnum <[email protected]>
  • Loading branch information
gregsfortytwo committed Apr 13, 2021
1 parent e1ae925 commit 73b461a
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/mon/Monitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down
22 changes: 19 additions & 3 deletions src/mon/OSDMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -956,16 +956,15 @@ 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 &&
(!osdmap.degraded_stretch_mode || osdmap.recovering_stretch_mode)) {
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();
}
}
}

Expand Down Expand Up @@ -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;
Expand Down
12 changes: 12 additions & 0 deletions src/mon/OSDMonitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -827,10 +827,22 @@ class OSDMonitor : public PaxosService,
*/
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.)
Expand Down

0 comments on commit 73b461a

Please sign in to comment.