@@ -234,146 +234,6 @@ function wait_background_check() {
234234 return $return_code
235235}
236236
237- # osd_scrub_during_recovery=true make sure scrub happens
238- # update 26.8.24: the test should be redesigned. The current version is not
239- # reliable, and playing around with the timeouts and such won't fix the
240- # design issues.
241- function TEST_recovery_scrub_2() {
242- local dir=$1
243- local poolname=test
244- return 0
245-
246- TESTDATA=" testdata.$$ "
247- OSDS=8
248- PGS=32
249- OBJECTS=40
250-
251- setup $dir || return 1
252- run_mon $dir a --osd_pool_default_size=1 --mon_allow_pool_size_one=true || return 1
253- run_mgr $dir x --mgr_stats_period=1 || return 1
254- local ceph_osd_args=" --osd-scrub-interval-randomize-ratio=0.1 "
255- ceph_osd_args+=" --osd_scrub_backoff_ratio=0 "
256- ceph_osd_args+=" --osd_stats_update_period_not_scrubbing=3 "
257- ceph_osd_args+=" --osd_stats_update_period_scrubbing=2 "
258- ceph_osd_args+=" --mgr_stats_period=1"
259- for osd in $( seq 0 $( expr $OSDS - 1) )
260- do
261- run_osd $dir $osd --osd_scrub_during_recovery=true --osd_recovery_sleep=1 \
262- $ceph_osd_args || return 1
263- done
264-
265- # Create a pool with $PGS pgs
266- create_pool $poolname $PGS $PGS
267- wait_for_clean || return 1
268- poolid=$( ceph osd dump | grep " ^pool.*[']test[']" | awk ' { print $2 }' )
269-
270- dd if=/dev/urandom of=$TESTDATA bs=1M count=50
271- for i in $( seq 1 $OBJECTS )
272- do
273- rados -p $poolname put obj${i} $TESTDATA
274- done
275- rm -f $TESTDATA
276-
277- ceph osd pool set $poolname size 3
278-
279- ceph pg dump pgs
280-
281- # note that the following will be needed if the mclock scheduler is specified
282- ceph tell osd.* config get osd_mclock_override_recovery_settings
283-
284- # the '_max_active' is expected to be 0
285- ceph tell osd.1 config get osd_recovery_max_active
286- # both next parameters are expected to be >=3
287- ceph tell osd.1 config set osd_recovery_max_active_hdd 6
288- ceph tell osd.1 config set osd_recovery_max_active_ssd 6
289- ceph tell osd.1 config get osd_recovery_max_active_hdd
290- ceph tell osd.1 config get osd_recovery_max_active_ssd
291-
292- # Wait for recovery to start
293- count=0
294- while(true)
295- do
296- # ceph --format json pg dump pgs | jq '.pg_stats | [.[].state]'
297- ceph pg dump pgs
298- if test $( ceph --format json pg dump pgs |
299- jq ' .pg_stats | [.[].state]' | grep recovering | wc -l) -ge 2
300- then
301- break
302- fi
303- sleep 2
304- if test " $count " -eq " 10"
305- then
306- echo " Not enough recovery started simultaneously"
307- return 1
308- fi
309- count=$( expr $count + 1)
310- done
311- ceph pg dump pgs
312-
313- pids=" "
314- recov_scrub_count=0
315- for pg in $( seq 0 $( expr $PGS - 1) )
316- do
317- run_in_background pids pg_scrub_mod $poolid .$( printf " %x" $pg )
318- done
319- wait_background_check pids
320- return_code=$?
321- if [ $return_code -ne 0 ]; then return $return_code ; fi
322-
323- ERRORS=0
324- if test $recov_scrub_count -eq 0
325- then
326- echo " No scrubs occurred while PG recovering"
327- ERRORS=$( expr $ERRORS + 1)
328- fi
329-
330- pidfile=$( find $dir 2> /dev/null | grep $name_prefix ' [^/]*\.pid' )
331- pid=$( cat $pidfile )
332- if ! kill -0 $pid
333- then
334- echo " OSD crash occurred"
335- # tail -100 $dir/osd.0.log
336- ERRORS=$( expr $ERRORS + 1)
337- fi
338-
339- # Work around for http://tracker.ceph.com/issues/38195
340- kill_daemons $dir # || return 1
341-
342- declare -a err_strings
343- # # we do not expect a refusal to scrub
344- err_strings[0]=" recovery in progress.*scrubs"
345- for osd in $( seq 0 $( expr $OSDS - 1) )
346- do
347- grep " recovery in progress.*scrubs" $dir /osd.${osd} .log
348- done
349- for err_string in " ${err_strings[@]} "
350- do
351- found=false
352- for osd in $( seq 0 $( expr $OSDS - 1) )
353- do
354- if grep " $err_string " $dir /osd.${osd} .log > /dev/null;
355- then
356- found=true
357- fi
358- done
359- if [ " $found " = " true" ]; then
360- echo " Found log message not expected '$err_string '"
361- ERRORS=$( expr $ERRORS + 1)
362- fi
363- done
364-
365- teardown $dir || return 1
366-
367- if [ $ERRORS != " 0" ];
368- then
369- echo " TEST FAILED WITH $ERRORS ERRORS"
370- return 1
371- fi
372-
373- echo " TEST PASSED"
374- return 0
375- }
376-
377237main osd-recovery-scrub " $@ "
378238
379239# Local Variables:
0 commit comments