mirror of
https://github.com/ceph/ceph
synced 2025-03-30 07:19:14 +00:00
Merge pull request #37941 from dzafman/wip-48077
Allowing scrub configs begin_day/end_day to include 7 and begin_hour/end_hour to include 24 is confusing Reviewed-by: Neha Ojha <nojha@redhat.com>
This commit is contained in:
commit
ada78607e6
@ -15,6 +15,14 @@
|
||||
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
|
||||
--------
|
||||
|
||||
|
@ -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``
|
||||
|
@ -274,7 +274,7 @@ function kill_daemon() {
|
||||
function test_kill_daemon() {
|
||||
local dir=$1
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 --mon_allow_pool_size_one=true || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
|
||||
@ -365,7 +365,7 @@ function kill_daemons() {
|
||||
function test_kill_daemons() {
|
||||
local dir=$1
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 --mon_allow_pool_size_one=true || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
#
|
||||
@ -514,7 +514,7 @@ function test_run_mon() {
|
||||
|
||||
kill_daemons $dir || return 1
|
||||
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 --mon_allow_pool_size_one=true || return 1
|
||||
local size=$(CEPH_ARGS='' ceph --format=json daemon $(get_asok_path mon.a) \
|
||||
config get osd_pool_default_size)
|
||||
test "$size" = '{"osd_pool_default_size":"1"}' || return 1
|
||||
@ -932,7 +932,7 @@ function wait_for_osd() {
|
||||
function test_wait_for_osd() {
|
||||
local dir=$1
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 --mon_allow_pool_size_one=true || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
run_osd $dir 1 || return 1
|
||||
@ -1038,7 +1038,7 @@ function test_get_pg() {
|
||||
local dir=$1
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 --mon_allow_pool_size_one=true || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
create_rbd_pool || return 1
|
||||
@ -1075,7 +1075,7 @@ function test_get_config() {
|
||||
|
||||
# override the default config using command line arg and check it
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 --mon_allow_pool_size_one=true || return 1
|
||||
test $(get_config mon a osd_pool_default_size) = 1 || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 --osd_max_scrubs=3 || return 1
|
||||
@ -1110,7 +1110,7 @@ function test_set_config() {
|
||||
local dir=$1
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 --mon_allow_pool_size_one=true || return 1
|
||||
test $(get_config mon a ms_crc_header) = true || return 1
|
||||
set_config mon a ms_crc_header false || return 1
|
||||
test $(get_config mon a ms_crc_header) = false || return 1
|
||||
@ -1142,7 +1142,7 @@ function test_get_primary() {
|
||||
local dir=$1
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 --mon_allow_pool_size_one=true || return 1
|
||||
local osd=0
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir $osd || return 1
|
||||
@ -1245,7 +1245,7 @@ function test_objectstore_tool() {
|
||||
local dir=$1
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 --mon_allow_pool_size_one=true || return 1
|
||||
local osd=0
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir $osd || return 1
|
||||
@ -1310,7 +1310,7 @@ function test_get_num_active_clean() {
|
||||
local dir=$1
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 --mon_allow_pool_size_one=true || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
create_rbd_pool || return 1
|
||||
@ -1340,7 +1340,7 @@ function test_get_num_active_or_peered() {
|
||||
local dir=$1
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 --mon_allow_pool_size_one=true || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
create_rbd_pool || return 1
|
||||
@ -1367,7 +1367,7 @@ function test_get_num_pgs() {
|
||||
local dir=$1
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 --mon_allow_pool_size_one=true || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
create_rbd_pool || return 1
|
||||
@ -1397,7 +1397,7 @@ function test_get_osd_id_used_by_pgs() {
|
||||
local dir=$1
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 --mon_allow_pool_size_one=true || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
create_rbd_pool || return 1
|
||||
@ -1439,7 +1439,7 @@ function test_wait_osd_id_used_by_pgs() {
|
||||
local dir=$1
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 --mon_allow_pool_size_one=true || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
create_rbd_pool || return 1
|
||||
@ -1471,7 +1471,7 @@ function test_get_last_scrub_stamp() {
|
||||
local dir=$1
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 --mon_allow_pool_size_one=true || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
create_rbd_pool || return 1
|
||||
@ -1499,7 +1499,7 @@ function test_is_clean() {
|
||||
local dir=$1
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 --mon_allow_pool_size_one=true || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
create_rbd_pool || return 1
|
||||
@ -1761,7 +1761,7 @@ function test_repair() {
|
||||
local dir=$1
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 --mon_allow_pool_size_one=true || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
create_rbd_pool || return 1
|
||||
@ -1801,7 +1801,7 @@ function test_pg_scrub() {
|
||||
local dir=$1
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 --mon_allow_pool_size_one=true || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
create_rbd_pool || return 1
|
||||
@ -1893,7 +1893,7 @@ function test_wait_for_scrub() {
|
||||
local dir=$1
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 --mon_allow_pool_size_one=true || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
create_rbd_pool || return 1
|
||||
@ -2095,7 +2095,7 @@ function test_flush_pg_stats()
|
||||
local dir=$1
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 --mon_allow_pool_size_one=true || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
create_rbd_pool || return 1
|
||||
|
@ -220,7 +220,7 @@ function TEST_crush_ls_node() {
|
||||
|
||||
function TEST_crush_reject_empty() {
|
||||
local dir=$1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 --mon_allow_pool_size_one=true || return 1
|
||||
# should have at least one OSD
|
||||
run_osd $dir 0 || return 1
|
||||
create_rbd_pool || return 1
|
||||
|
@ -20,7 +20,7 @@ function TEST_reuse_id() {
|
||||
local dir=$1
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 --mon_allow_pool_size_one=true || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
run_osd $dir 1 || return 1
|
||||
|
@ -35,7 +35,7 @@ function TEST_reuse_id() {
|
||||
local dir=$1
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 --mon_allow_pool_size_one=true || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
run_osd $dir 1 || return 1
|
||||
|
@ -88,7 +88,7 @@ function TEST_import_after_merge_and_gap() {
|
||||
local dir=$1
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 --mon_allow_pool_size_one=true || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
|
||||
@ -163,7 +163,7 @@ function TEST_import_after_split() {
|
||||
local dir=$1
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 --mon_allow_pool_size_one=true || return 1
|
||||
run_mgr $dir x || return 1
|
||||
run_osd $dir 0 || return 1
|
||||
|
||||
|
@ -42,7 +42,7 @@ function TEST_recovery_scrub() {
|
||||
OBJECTS=4
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 --mon_allow_pool_size_one=true || return 1
|
||||
run_mgr $dir x || return 1
|
||||
for osd in $(seq 0 $(expr $OSDS - 1))
|
||||
do
|
||||
|
@ -5804,7 +5804,7 @@ function TEST_scrub_warning() {
|
||||
local pool_overdue_seconds=$(calc $i14_days + $i1_day + \( $i14_days \* $overdue \) )
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 --mon_allow_pool_size_one=true || return 1
|
||||
run_mgr $dir x --mon_warn_pg_not_scrubbed_ratio=${overdue} --mon_warn_pg_not_deep_scrubbed_ratio=${overdue} || return 1
|
||||
run_osd $dir 0 $ceph_osd_args --osd_scrub_backoff_ratio=0 || return 1
|
||||
|
||||
@ -6152,7 +6152,7 @@ function TEST_request_scrub_priority() {
|
||||
local PGS=8
|
||||
|
||||
setup $dir || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 || return 1
|
||||
run_mon $dir a --osd_pool_default_size=1 --mon_allow_pool_size_one=true || return 1
|
||||
run_mgr $dir x || return 1
|
||||
local ceph_osd_args="--osd-scrub-interval-randomize-ratio=0 --osd-deep-scrub-randomize-ratio=0 "
|
||||
ceph_osd_args+="--osd_scrub_backoff_ratio=0"
|
||||
|
@ -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:
|
||||
|
@ -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)
|
||||
|
@ -70,8 +70,26 @@ TEST(TestOSDScrub, scrub_time_permit) {
|
||||
mc.build_initial_monmap();
|
||||
TestOSDScrub* osd = new TestOSDScrub(g_ceph_context, store, 0, ms, ms, ms, ms, ms, ms, ms, &mc, "", "", icp);
|
||||
|
||||
// These are now invalid
|
||||
int err = g_ceph_context->_conf.set_val("osd_scrub_begin_hour", "24");
|
||||
ASSERT_TRUE(err < 0);
|
||||
//GTEST_LOG_(INFO) << " osd_scrub_begin_hour = " << g_ceph_context->_conf.get_val<int64_t>("osd_scrub_begin_hour");
|
||||
|
||||
err = g_ceph_context->_conf.set_val("osd_scrub_end_hour", "24");
|
||||
ASSERT_TRUE(err < 0);
|
||||
//GTEST_LOG_(INFO) << " osd_scrub_end_hour = " << g_ceph_context->_conf.get_val<int64_t>("osd_scrub_end_hour");
|
||||
|
||||
err = g_ceph_context->_conf.set_val("osd_scrub_begin_week_day", "7");
|
||||
ASSERT_TRUE(err < 0);
|
||||
//GTEST_LOG_(INFO) << " osd_scrub_begin_week_day = " << g_ceph_context->_conf.get_val<int64_t>("osd_scrub_begin_week_day");
|
||||
|
||||
err = g_ceph_context->_conf.set_val("osd_scrub_end_week_day", "7");
|
||||
ASSERT_TRUE(err < 0);
|
||||
//GTEST_LOG_(INFO) << " osd_scrub_end_week_day = " << g_ceph_context->_conf.get_val<int64_t>("osd_scrub_end_week_day");
|
||||
|
||||
// Test all day
|
||||
g_ceph_context->_conf.set_val("osd_scrub_begin_hour", "0");
|
||||
g_ceph_context->_conf.set_val("osd_scrub_end_hour", "24");
|
||||
g_ceph_context->_conf.set_val("osd_scrub_end_hour", "0");
|
||||
g_ceph_context->_conf.apply_changes(nullptr);
|
||||
tm tm;
|
||||
tm.tm_isdst = -1;
|
||||
@ -80,22 +98,6 @@ TEST(TestOSDScrub, scrub_time_permit) {
|
||||
bool ret = osd->scrub_time_permit(now);
|
||||
ASSERT_TRUE(ret);
|
||||
|
||||
g_ceph_context->_conf.set_val("osd_scrub_begin_hour", "24");
|
||||
g_ceph_context->_conf.set_val("osd_scrub_end_hour", "0");
|
||||
g_ceph_context->_conf.apply_changes(nullptr);
|
||||
strptime("2015-01-16 12:05:13", "%Y-%m-%d %H:%M:%S", &tm);
|
||||
now = utime_t(mktime(&tm), 0);
|
||||
ret = osd->scrub_time_permit(now);
|
||||
ASSERT_FALSE(ret);
|
||||
|
||||
g_ceph_context->_conf.set_val("osd_scrub_begin_hour", "0");
|
||||
g_ceph_context->_conf.set_val("osd_scrub_end_hour", "0");
|
||||
g_ceph_context->_conf.apply_changes(nullptr);
|
||||
strptime("2015-01-16 12:05:13", "%Y-%m-%d %H:%M:%S", &tm);
|
||||
now = utime_t(mktime(&tm), 0);
|
||||
ret = osd->scrub_time_permit(now);
|
||||
ASSERT_TRUE(ret);
|
||||
|
||||
g_ceph_context->_conf.set_val("osd_scrub_begin_hour", "20");
|
||||
g_ceph_context->_conf.set_val("osd_scrub_end_hour", "07");
|
||||
g_ceph_context->_conf.apply_changes(nullptr);
|
||||
@ -144,6 +146,53 @@ TEST(TestOSDScrub, scrub_time_permit) {
|
||||
ret = osd->scrub_time_permit(now);
|
||||
ASSERT_TRUE(ret);
|
||||
|
||||
// Sun = 0, Mon = 1, Tue = 2, Wed = 3, Thu = 4m, Fri = 5, Sat = 6
|
||||
// Jan 16, 2015 is a Friday (5)
|
||||
// every day
|
||||
g_ceph_context->_conf.set_val("osd_scrub_begin_week day", "0"); // inclusive
|
||||
g_ceph_context->_conf.set_val("osd_scrub_end_week_day", "0"); // not inclusive
|
||||
g_ceph_context->_conf.apply_changes(nullptr);
|
||||
strptime("2015-01-16 04:05:13", "%Y-%m-%d %H:%M:%S", &tm);
|
||||
now = utime_t(mktime(&tm), 0);
|
||||
ret = osd->scrub_time_permit(now);
|
||||
ASSERT_TRUE(ret);
|
||||
|
||||
// test Sun - Thu
|
||||
g_ceph_context->_conf.set_val("osd_scrub_begin_week day", "0"); // inclusive
|
||||
g_ceph_context->_conf.set_val("osd_scrub_end_week_day", "5"); // not inclusive
|
||||
g_ceph_context->_conf.apply_changes(nullptr);
|
||||
strptime("2015-01-16 04:05:13", "%Y-%m-%d %H:%M:%S", &tm);
|
||||
now = utime_t(mktime(&tm), 0);
|
||||
ret = osd->scrub_time_permit(now);
|
||||
ASSERT_FALSE(ret);
|
||||
|
||||
// test Fri - Sat
|
||||
g_ceph_context->_conf.set_val("osd_scrub_begin_week day", "5"); // inclusive
|
||||
g_ceph_context->_conf.set_val("osd_scrub_end_week_day", "0"); // not inclusive
|
||||
g_ceph_context->_conf.apply_changes(nullptr);
|
||||
strptime("2015-01-16 04:05:13", "%Y-%m-%d %H:%M:%S", &tm);
|
||||
now = utime_t(mktime(&tm), 0);
|
||||
ret = osd->scrub_time_permit(now);
|
||||
ASSERT_TRUE(ret);
|
||||
|
||||
// Jan 14, 2015 is a Wednesday (3)
|
||||
// test Tue - Fri
|
||||
g_ceph_context->_conf.set_val("osd_scrub_begin_week day", "2"); // inclusive
|
||||
g_ceph_context->_conf.set_val("osd_scrub_end_week_day", "6"); // not inclusive
|
||||
g_ceph_context->_conf.apply_changes(nullptr);
|
||||
strptime("2015-01-14 04:05:13", "%Y-%m-%d %H:%M:%S", &tm);
|
||||
now = utime_t(mktime(&tm), 0);
|
||||
ret = osd->scrub_time_permit(now);
|
||||
ASSERT_TRUE(ret);
|
||||
|
||||
// Test Sat - Sun
|
||||
g_ceph_context->_conf.set_val("osd_scrub_begin_week day", "6"); // inclusive
|
||||
g_ceph_context->_conf.set_val("osd_scrub_end_week_day", "1"); // not inclusive
|
||||
g_ceph_context->_conf.apply_changes(nullptr);
|
||||
strptime("2015-01-14 04:05:13", "%Y-%m-%d %H:%M:%S", &tm);
|
||||
now = utime_t(mktime(&tm), 0);
|
||||
ret = osd->scrub_time_permit(now);
|
||||
ASSERT_FALSE(ret);
|
||||
}
|
||||
|
||||
// Local Variables:
|
||||
|
Loading…
Reference in New Issue
Block a user