local num_active_clean=-1
local cur_active_clean
local -i timer=0
+ local -i loops=0
+ local -i phase=0
local num_pgs=$(get_num_pgs)
test $num_pgs != 0 || return 1
+ local TENTH_TIMEOUT=($TIMEOUT * 10)
+ # The first phase 10 times (1 second) second phase an additional 15 times (15 seconds)
+ local backoff_phases=( 10 15 -1 )
+ local sleep_backoff=( .1 1 10)
while true ; do
# Comparing get_num_active_clean & get_num_pgs is used to determine
cur_active_clean=$(get_num_active_clean)
test $cur_active_clean = $num_pgs && break
if test $cur_active_clean != $num_active_clean ; then
- timer=0
+ timer=0 ; loops=0 ; phase=0
num_active_clean=$cur_active_clean
elif get_is_making_recovery_progress ; then
- timer=0
- elif (( timer >= $(($TIMEOUT * 10)))) ; then
+ timer=0 ; loops=0 ; phase=0
+ elif (( timer >= $TENTH_TIMEOUT)) ; then
ceph report
return 1
fi
- sleep .1
- timer=$(expr $timer + 1)
+ sleep ${sleep_backoff[$phase]}
+ timer="$(echo $timer + ${sleep_backoff[$phase]} \* 10 | bc | cut -d. -f1)"
+ loops=$(expr $loops + 1)
+ if (( $loops == ${backoff_phases[$phase]} )); then
+ phase=$(expr $phase + 1)
+ loop=0
+ fi
done
return 0
}