]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: Eliminate day of weeek 7 and hour 24
authorDavid Zafman <dzafman@redhat.com>
Tue, 3 Nov 2020 03:26:57 +0000 (03:26 +0000)
committerDavid Zafman <dzafman@redhat.com>
Mon, 9 Nov 2020 22:47:00 +0000 (22:47 +0000)
Add test case for permitted hours to make sure scrub doesn't start
Remove permitted hours in extended sleep test

Fixes: https://tracker.ceph.com/issues/48077
Signed-off-by: David Zafman <dzafman@redhat.com>
PendingReleaseNotes
doc/rados/configuration/osd-config-ref.rst
qa/standalone/scrub/osd-scrub-test.sh
src/common/options.cc

index 32e8b0addbd7c6fbf159cc3073177cacd1c390b6..13e3e818927c75c38ede705d43def1c053071774 100644 (file)
   Please refer to https://docs.ceph.com/en/latest/ceph-volume/lvm/batch/ for
   more detailed information.
 
+* Configuration variables for permitted scrub times have changed.  The legal
+  values for ``osd_scrub_begin_hour`` and ``osd_scrub_end_hour`` are 0 - 23.
+  The use of 24 is now illegal.  Specifying ``0`` for both values causes every
+  hour to be allowed.  The legal vaues for ``osd_scrub_begin_week_day`` and
+  ``osd_scrub_end_week_day`` are 0 - 6.  The use of 7 is now illegal.
+  Specifying ``0`` for both values causes every day of the week to be allowed.
+
+
 >=15.0.0
 --------
 
index c3e65f60924292026f0f93fc2290b1bb970cb288..b0705f3e74354441de32a23b15902a0ea8137ba7 100644 (file)
@@ -218,37 +218,53 @@ scrubbing operations.
 
 ``osd scrub begin hour``
 
-:Description: The time of day for the lower bound when a scheduled scrub can be
-              performed.
-:Type: Integer in the range of 0 to 24
+:Description: This restricts scrubbing to this hour of the day or later.
+              Use ``osd scrub begin hour = 0`` and ``osd scrub end hour = 0``
+              to allow scrubbing the entire day.  Along with ``osd scrub end hour``, they define a time
+              window, in which the scrubs can happen.
+              But a scrub will be performed
+              no matter whether the time window allows or not, as long as the placement
+              group's scrub interval exceeds ``osd scrub max interval``.
+:Type: Integer in the range of 0 to 23
 :Default: ``0``
 
 
 ``osd scrub end hour``
 
-:Description: The time of day for the upper bound when a scheduled scrub can be
-              performed. Along with ``osd scrub begin hour``, they define a time
+:Description: This restricts scrubbing to the hour earlier than this.
+              Use ``osd scrub begin hour = 0`` and ``osd scrub end hour = 0`` to allow scrubbing
+              for the entire day.  Along with ``osd scrub begin hour``, they define a time
               window, in which the scrubs can happen. But a scrub will be performed
-              no matter the time window allows or not, as long as the placement
+              no matter whether the time window allows or not, as long as the placement
               group's scrub interval exceeds ``osd scrub max interval``.
-:Type: Integer in the range of 0 to 24
-:Default: ``24``
+:Type: Integer in the range of 0 to 23
+:Default: ``0``
 
 
 ``osd scrub begin week day``
 
 :Description: This restricts scrubbing to this day of the week or later.
-              0 or 7 = Sunday, 1 = Monday, etc.
-:Type: Integer in the range of 0 to 7
+              0  = Sunday, 1 = Monday, etc. Use ``osd scrub begin week day = 0``
+              and ``osd scrub end week day = 0`` to allow scrubbing for the entire week.
+              Along with ``osd scrub end week day``, they define a time window, in which
+              the scrubs can happen. But a scrub will be performed
+              no matter whether the time window allows or not, as long as the placement
+              group's scrub interval exceeds ``osd scrub max interval``.
+:Type: Integer in the range of 0 to 6
 :Default: ``0``
 
 
 ``osd scrub end week day``
 
 :Description: This restricts scrubbing to days of the week earlier than this.
-              0 or 7 = Sunday, 1 = Monday, etc.
-:Type: Integer in the range of 0 to 7
-:Default: ``7``
+              0 = Sunday, 1 = Monday, etc.  Use ``osd scrub begin week day = 0``
+              and ``osd scrub end week day = 0`` to allow scrubbing for the entire week.
+              Along with ``osd scrub begin week day``, they define a time
+              window, in which the scrubs can happen. But a scrub will be performed
+              no matter whether the time window allows or not, as long as the placement
+              group's scrub interval exceeds ``osd scrub max interval``.
+:Type: Integer in the range of 0 to 6
+:Default: ``0``
 
 
 ``osd scrub during recovery``
index 89534938063e0899595724c2be282f1c82eb5036..3e1cd0d984b0b19fc8ff860dfad8a9fea4411361 100755 (executable)
@@ -198,15 +198,13 @@ function TEST_scrub_extented_sleep() {
     setup $dir || return 1
     run_mon $dir a --osd_pool_default_size=3 || return 1
     run_mgr $dir x || return 1
-    local scrub_begin_hour=$(date -d '2 hour ago' +"%H" | sed 's/^0//')
-    local scrub_end_hour=$(date -d '1 hour ago' +"%H" | sed 's/^0//')
     for osd in $(seq 0 $(expr $OSDS - 1))
     do
       run_osd $dir $osd --osd_scrub_sleep=0 \
                         --osd_scrub_extended_sleep=10 \
                         --bluestore_cache_autotune=false \
-                        --osd_scrub_begin_hour=$scrub_begin_hour \
-                        --osd_scrub_end_hour=$scrub_end_hour || return 1
+                       --osd_deep_scrub_randomize_ratio=0.0 \
+                       --osd_scrub_interval_randomize_ratio=0 || return 1
     done
 
     # Create a pool with a single pg
@@ -344,6 +342,53 @@ function TEST_deep_scrub_abort() {
     _scrub_abort $dir deep_scrub
 }
 
+function TEST_scrub_permit_time() {
+    local dir=$1
+    local poolname=test
+    local OSDS=3
+    local objects=15
+
+    TESTDATA="testdata.$$"
+
+    setup $dir || return 1
+    run_mon $dir a --osd_pool_default_size=3 || return 1
+    run_mgr $dir x || return 1
+    local scrub_begin_hour=$(date -d '2 hour ago' +"%H" | sed 's/^0//')
+    local scrub_end_hour=$(date -d '1 hour ago' +"%H" | sed 's/^0//')
+    for osd in $(seq 0 $(expr $OSDS - 1))
+    do
+      run_osd $dir $osd --bluestore_cache_autotune=false \
+                       --osd_deep_scrub_randomize_ratio=0.0 \
+                       --osd_scrub_interval_randomize_ratio=0 \
+                        --osd_scrub_begin_hour=$scrub_begin_hour \
+                        --osd_scrub_end_hour=$scrub_end_hour || return 1
+    done
+
+    # Create a pool with a single pg
+    create_pool $poolname 1 1
+    wait_for_clean || return 1
+
+    # Trigger a scrub on a PG
+    local pgid=$(get_pg $poolname SOMETHING)
+    local primary=$(get_primary $poolname SOMETHING)
+    local last_scrub=$(get_last_scrub_stamp $pgid)
+    # If we don't specify an amount of time to subtract from
+    # current time to set last_scrub_stamp, it sets the deadline
+    # back by osd_max_interval which would cause the time permit checking
+    # to be skipped.  Set back 1 day, the default scrub_min_interval.
+    ceph tell $pgid scrub $(( 24 * 60 * 60 )) || return 1
+
+    # Scrub should not run
+    for ((i=0; i < 30; i++)); do
+        if test "$(get_last_scrub_stamp $pgid)" '>' "$last_scrub" ; then
+            return 1
+        fi
+        sleep 1
+    done
+
+    teardown $dir || return 1
+}
+
 main osd-scrub-test "$@"
 
 # Local Variables:
index 34bee688353f973063affbf1285142af9582b728..f8c3ea1bec3ccd35e51e609484152cf870bde738 100644 (file)
@@ -3257,24 +3257,30 @@ std::vector<Option> get_global_options() {
 
     Option("osd_scrub_begin_hour", Option::TYPE_INT, Option::LEVEL_ADVANCED)
     .set_default(0)
+    .set_min_max(0, 23)
     .set_description("Restrict scrubbing to this hour of the day or later")
+    .set_long_description("Use osd_scrub_begin_hour=0 and osd_scrub_end_hour=0 for the entire day.")
     .add_see_also("osd_scrub_end_hour"),
 
     Option("osd_scrub_end_hour", Option::TYPE_INT, Option::LEVEL_ADVANCED)
-    .set_default(24)
+    .set_default(0)
+    .set_min_max(0, 23)
     .set_description("Restrict scrubbing to hours of the day earlier than this")
+    .set_long_description("Use osd_scrub_begin_hour=0 and osd_scrub_end_hour=0 for the entire day.")
     .add_see_also("osd_scrub_begin_hour"),
 
     Option("osd_scrub_begin_week_day", Option::TYPE_INT, Option::LEVEL_ADVANCED)
     .set_default(0)
+    .set_min_max(0, 6)
     .set_description("Restrict scrubbing to this day of the week or later")
-    .set_long_description("0 or 7 = Sunday, 1 = Monday, etc.")
+    .set_long_description("0 = Sunday, 1 = Monday, etc. Use osd_scrub_begin_week_day=0 osd_scrub_end_week_day=0 for the entire week.")
     .add_see_also("osd_scrub_end_week_day"),
 
     Option("osd_scrub_end_week_day", Option::TYPE_INT, Option::LEVEL_ADVANCED)
-    .set_default(7)
+    .set_default(0)
+    .set_min_max(0, 6)
     .set_description("Restrict scrubbing to days of the week earlier than this")
-    .set_long_description("0 or 7 = Sunday, 1 = Monday, etc.")
+    .set_long_description("0 = Sunday, 1 = Monday, etc. Use osd_scrub_begin_week_day=0 osd_scrub_end_week_day=0 for the entire week.")
     .add_see_also("osd_scrub_begin_week_day"),
 
     Option("osd_scrub_load_threshold", Option::TYPE_FLOAT, Option::LEVEL_ADVANCED)