From 73b461a4f3ab87e20b4df5cae292e70a85a65d69 Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Tue, 13 Apr 2021 05:28:31 +0000 Subject: [PATCH] mon: maintain stretch_recovery_triggered in new OSDMon::set_*_stretch_mode Signed-off-by: Greg Farnum --- src/mon/Monitor.cc | 3 +++ src/mon/OSDMonitor.cc | 22 +++++++++++++++++++--- src/mon/OSDMonitor.h | 12 ++++++++++++ 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 5198b634eb8..ed838eb4db9 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -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) diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 0428d5355cf..ce29f7d6458 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -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; diff --git a/src/mon/OSDMonitor.h b/src/mon/OSDMonitor.h index 1617f9bfc5a..7ea12590c76 100644 --- a/src/mon/OSDMonitor.h +++ b/src/mon/OSDMonitor.h @@ -827,10 +827,22 @@ public: */ void trigger_degraded_stretch_mode(const set& dead_buckets, const set& 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.)