From 33f1f6077804dbcbb82a41ef7f6803b5f3365831 Mon Sep 17 00:00:00 2001 From: Wido den Hollander Date: Wed, 9 Nov 2016 15:24:02 +0100 Subject: [PATCH] osd: Add config option to disable new scrubs during recovery The osd_scrub_during_recovery config option allows for configuring if the OSD will schedule a new scrub while recovery is active. When set to false no new scrubs will be initiated by the OSD while there are recovery threads active on that OSD. Signed-off-by: Wido den Hollander --- src/common/config_opts.h | 1 + src/osd/OSD.cc | 13 +++++++++++++ src/osd/OSD.h | 1 + 3 files changed, 15 insertions(+) diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 169625242627b..cb86b1501559e 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -771,6 +771,7 @@ OPTION(osd_max_push_cost, OPT_U64, 8<<20) // max size of push message OPTION(osd_max_push_objects, OPT_U64, 10) // max objects in single push op OPTION(osd_recovery_forget_lost_objects, OPT_BOOL, false) // off for now OPTION(osd_max_scrubs, OPT_INT, 1) +OPTION(osd_scrub_during_recovery, OPT_BOOL, true) // Allow new scrubs to start while recovery is active on the OSD OPTION(osd_scrub_begin_hour, OPT_INT, 0) OPTION(osd_scrub_end_hour, OPT_INT, 24) OPTION(osd_scrub_load_threshold, OPT_FLOAT, 0.5) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 3f01634a7c0d6..6c939f9cf0634 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -6576,6 +6576,11 @@ void OSD::sched_scrub() break; } + if (!cct->_conf->osd_scrub_during_recovery && service.is_recovery_active()) { + dout(10) << __func__ << "not scheduling scrub of " << scrub.pgid << " due to active recovery ops" << dendl; + break; + } + PG *pg = _lookup_lock_pg(scrub.pgid); if (!pg) continue; @@ -8552,6 +8557,14 @@ void OSDService::finish_recovery_op(PG *pg, const hobject_t& soid, bool dequeue) _maybe_queue_recovery(); } +bool OSDService::is_recovery_active() +{ + if (recovery_ops_active > 0) + return true; + + return false; +} + // ========================================================= // OPS diff --git a/src/osd/OSD.h b/src/osd/OSD.h index a08a34f454623..a79aa161b88c0 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -944,6 +944,7 @@ private: public: void start_recovery_op(PG *pg, const hobject_t& soid); void finish_recovery_op(PG *pg, const hobject_t& soid, bool dequeue); + bool is_recovery_active(); void release_reserved_pushes(uint64_t pushes) { Mutex::Locker l(recovery_lock); assert(recovery_ops_reserved >= pushes); -- 2.39.5