]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: osd-scrub-repair.sh disable scrub backoff in test 13334/head
authorKefu Chai <kchai@redhat.com>
Thu, 9 Feb 2017 16:54:54 +0000 (00:54 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 9 Feb 2017 19:25:12 +0000 (03:25 +0800)
there is good chance that the newly scheduled scrub fail to pass the
flip-coin check: the probability of scheduling a new scrub 1/3 every
time we flip the coin. so, instead hardwiring the probability to 1/3,
a new option named "osd_scrub_backoff_ratio" is introduced. so we can
override it when performing test.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/common/config_opts.h
src/osd/OSD.cc
src/test/osd/osd-scrub-repair.sh

index 6e3f37917a64a35962170298ceeb235fe6601368..3a27dbed58df17ace7a08f5f29ea3eac7cc6b716 100644 (file)
@@ -808,6 +808,7 @@ OPTION(osd_scrub_load_threshold, OPT_FLOAT, 0.5)
 OPTION(osd_scrub_min_interval, OPT_FLOAT, 60*60*24)    // if load is low
 OPTION(osd_scrub_max_interval, OPT_FLOAT, 7*60*60*24)  // regardless of load
 OPTION(osd_scrub_interval_randomize_ratio, OPT_FLOAT, 0.5) // randomize the scheduled scrub in the span of [min,min*(1+randomize_ratio))
+OPTION(osd_scrub_backoff_ratio, OPT_DOUBLE, .66)   // the probability to back off the scheduled scrub
 OPTION(osd_scrub_chunk_min, OPT_INT, 5)
 OPTION(osd_scrub_chunk_max, OPT_INT, 25)
 OPTION(osd_scrub_sleep, OPT_FLOAT, 0)   // sleep between [deep]scrub ops
index c7c281dbf9fa97f261cd553ba7f19a9a9908b2f0..95b3062e65c95c8b8b524a1ac1e0aca5e49d9793 100644 (file)
@@ -6582,7 +6582,8 @@ void OSD::handle_scrub(MOSDScrub *m)
 
 bool OSD::scrub_random_backoff()
 {
-  bool coin_flip = (rand() % 3) == whoami % 3;
+  bool coin_flip = (rand() / (double)RAND_MAX >=
+                   cct->_conf->osd_scrub_backoff_ratio);
   if (!coin_flip) {
     dout(20) << "scrub_random_backoff lost coin flip, randomly backing off" << dendl;
     return true;
index 680af924ad1c7c3bd092fdfcadb0491451c540ec..a912933c0c858ce271dbc1affba2bba189bdfd42 100755 (executable)
@@ -2227,7 +2227,11 @@ function TEST_periodic_scrub_replicated() {
     rados list-inconsistent-obj $pg | jq '.' | grep -q $objname || return 1
 
     # Request a regular scrub and it will be done
+    local scrub_backoff_ratio=$(get_config osd ${primary} osd_scrub_backoff_ratio)
+    set_config osd ${primary} osd_scrub_backoff_ratio 0
     pg_scrub $pg
+    sleep 1
+    set_config osd ${primary} osd_scrub_backoff_ratio $scrub_backoff_ratio
     grep -q "Regular scrub request, losing deep-scrub details" $dir/osd.${primary}.log || return 1
 
     # deep-scrub error is no longer present