Skip to content

Commit 0a76d6c

Browse files
committed
qa/standalone/scrub: retry in TEST_abort_periodic_for_operator()
The scenario created in the test requires two PGs that share the same Primary, and at least one more member of their active sets. The PR handles the (unlikely) case where the first PG tried does not have a counterpart that matches the requirements. A minor related fix in scrub-helpers.sh: using 'printf' to return a value, instead of an out (ref) parameter. Fixes: https://tracker.ceph.com/issues/69837 Signed-off-by: Ronen Friedman <[email protected]>
1 parent e11d6ce commit 0a76d6c

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

qa/standalone/scrub/osd-scrub-test.sh

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -790,23 +790,25 @@ function TEST_abort_periodic_for_operator() {
790790
(( extr_dbg >= 2 )) && ceph tell osd.2 dump_scrub_reservations --format=json-pretty
791791

792792
# the first PG to work with:
793-
local pg1="1.0"
794-
# and another one, that shares its primary, and at least one more active set member
795793
local pg2=""
796-
for pg in "${!pg_pr[@]}"; do
797-
if [[ "${pg_pr[$pg]}" == "${pg_pr[$pg1]}" ]]; then
798-
local -i common=0
799-
count_common_active $pg $pg1 pg_ac common
800-
if [[ $common -gt 1 ]]; then
801-
pg2=$pg
802-
break
794+
for pg1 in "${!pg_pr[@]}"; do
795+
for pg in "${!pg_pr[@]}"; do
796+
if [[ "$pg" == "$pg1" ]]; then
797+
continue
803798
fi
804-
fi
799+
if [[ "${pg_pr[$pg]}" == "${pg_pr[$pg1]}" ]]; then
800+
local -i common=$(count_common_active $pg $pg1 pg_ac)
801+
if [[ $common -gt 1 ]]; then
802+
pg2=$pg
803+
break 2
804+
fi
805+
fi
806+
done
805807
done
808+
806809
if [[ -z "$pg2" ]]; then
807-
# \todo handle the case when no such PG is found
808810
echo "No PG found with the same primary as $pg1"
809-
return 1
811+
return 0 # not an error
810812
fi
811813

812814
# the common primary is allowed two concurrent scrubs

qa/standalone/scrub/scrub-helpers.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,6 @@ function count_common_active {
358358
local pg1=$1
359359
local pg2=$2
360360
local -n pg_acting_dict=$3
361-
local -n res=$4
362361

363362
local -a a1=(${pg_acting_dict[$pg1]})
364363
local -a a2=(${pg_acting_dict[$pg2]})
@@ -372,7 +371,7 @@ function count_common_active {
372371
done
373372
done
374373

375-
res=$cnt
374+
printf '%d' "$cnt"
376375
}
377376

378377

@@ -389,8 +388,7 @@ function find_disjoint_but_primary {
389388

390389
for cand in "${!ac_dict[@]}"; do
391390
if [[ "$cand" != "$pg" ]]; then
392-
local -i common=0
393-
count_common_active "$pg" "$cand" ac_dict common
391+
local -i common=$(count_common_active "$pg" "$cand" ac_dict)
394392
if [[ $common -eq 0 || ( $common -eq 1 && "${p_dict[$pg]}" == "${p_dict[$cand]}" )]]; then
395393
res=$cand
396394
return

0 commit comments

Comments
 (0)