]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: Add config option to disable new scrubs during recovery 11944/head
authorWido den Hollander <wido@42on.com>
Wed, 9 Nov 2016 14:24:02 +0000 (15:24 +0100)
committerNathan Cutler <ncutler@suse.com>
Mon, 14 Nov 2016 17:47:46 +0000 (18:47 +0100)
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 <wido@42on.com>
(cherry picked from commit 33f1f6077804dbcbb82a41ef7f6803b5f3365831)

Conflicts:
src/osd/OSD.h (between jewel and kraken, pg recovery methods were moved
        from the OSD class to OSDService)

src/common/config_opts.h
src/osd/OSD.cc
src/osd/OSD.h

index 3795f0ec3e6c2f998b09ee005622ca2292638351..d74e8fe9dbacfdf961bec96329b54fb11af87c91 100644 (file)
@@ -754,6 +754,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)
index 6b503a50b60d168442aa42e1f602e90217902cd0..d6937f13abca7ca7b63ea85311f7c5911165d39f 100644 (file)
@@ -6436,6 +6436,11 @@ void OSD::sched_scrub()
        break;
       }
 
+      if (!cct->_conf->osd_scrub_during_recovery && 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;
@@ -8397,6 +8402,14 @@ void OSD::finish_recovery_op(PG *pg, const hobject_t& soid, bool dequeue)
   recovery_wq.unlock();
 }
 
+bool OSD::is_recovery_active()
+{
+  if (recovery_ops_active > 0)
+    return true;
+
+  return false;
+}
+
 // =========================================================
 // OPS
 
index 1d918ff57e035c4f7fff8669aeeecc16275785ca..84381651b312c50e505d8c6f3803d42fc50162e5 100644 (file)
@@ -2283,6 +2283,7 @@ protected:
 
   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 do_recovery(PG *pg, ThreadPool::TPHandle &handle);
   bool _recover_now();