@@ -90,27 +90,28 @@ while getopts 'l:' opt; do
9090 esac
9191done
9292
93- export loop_log=/tmp/repair_restart.log
94- export test_log=/tmp/repair_restart_test.log
95- export dsc_log=/tmp/repair_restart_dsc.log
96- export region_dir=" ./var"
97-
98- echo " " > ${loop_log}
99- echo " starting $( date) " | tee ${loop_log}
100- echo " " > ${test_log}
93+ WORK_ROOT=${WORK_ROOT:-/ tmp}
94+ export loop_log=" $WORK_ROOT /repair_restart.log"
95+ export test_log=" $WORK_ROOT /repair_restart_test.log"
96+ export dsc_log=" $WORK_ROOT /repair_restart_dsc.log"
97+ REGION_ROOT=${REGION_ROOT:-/ var/ tmp/ test_restart_repair}
98+
99+ echo " " > " $loop_log "
100+ echo " starting $( date) " | tee " $loop_log "
101+ echo " " > " $test_log "
101102echo " Tail $test_log for test output"
102103echo " Tail $loop_log for summary output"
103104echo " Tail $dsc_log for dsc outout"
104105
105106echo " Create a new region to test" | tee -a " ${loop_log} "
106107ulimit -n 65536
107- if ! " $dsc " create --cleanup --ds-bin " $cds " --extent-count 61 --extent-size 5120 --region-dir " $region_dir " ; then
108- echo " Failed to create region at $region_dir "
108+ if ! " $dsc " create --cleanup --ds-bin " $cds " --extent-count 61 --extent-size 5120 --region-dir " $REGION_ROOT " ; then
109+ echo " Failed to create region at $REGION_ROOT "
109110 exit 1
110111fi
111112
112113echo " Starting the downstairs" | tee -a " ${loop_log} "
113- " $dsc " start --ds-bin " $cds " --region-dir " $region_dir " >> ${ dsc_log} 2>&1 &
114+ " $dsc " start --ds-bin " $cds " --region-dir " $REGION_ROOT " >> " $ dsc_log" 2>&1 &
114115dsc_pid=$!
115116# Sleep 5 to give the downstairs time to get going.
116117sleep 5
@@ -158,10 +159,10 @@ stop_all_downstairs
158159sleep 7
159160
160161# Create the "old" region files
161- rm -rf " $region_dir " /8810.old " $region_dir " /8820.old " $region_dir " /8830.old
162- cp -R " $region_dir " /8810 " $region_dir " /8810.old || ctrl_c
163- cp -R " $region_dir " /8820 " $region_dir " /8820.old || ctrl_c
164- cp -R " $region_dir " /8830 " $region_dir " /8830.old || ctrl_c
162+ rm -rf " $REGION_ROOT " /8810.old " $REGION_ROOT " /8820.old " $REGION_ROOT " /8830.old
163+ cp -R " $REGION_ROOT " /8810 " $REGION_ROOT " /8810.old || ctrl_c
164+ cp -R " $REGION_ROOT " /8820 " $REGION_ROOT " /8820.old || ctrl_c
165+ cp -R " $REGION_ROOT " /8830 " $REGION_ROOT " /8830.old || ctrl_c
165166
166167# Bring the downstairs back online.
167168echo " $( date) Bring downstairs back online" | tee -a " $loop_log "
182183echo " Fill completed, wait for downstairs to start restarting" >> " $test_log "
183184duration=$SECONDS
184185printf " Initial fill and verify took: %d:%02d \n" \
185- $(( duration / 60 )) $(( duration % 60 )) | tee -a ${ loop_log}
186+ $(( duration / 60 )) $(( duration % 60 )) | tee -a " $ loop_log"
186187
187188# Now run the repair loop
188189count=1
@@ -202,19 +203,19 @@ while [[ $count -le $loops ]]; do
202203 echo " $( date) move regions" >> " $test_log "
203204 choice=$(( RANDOM % 3 ))
204205 if [[ $choice -eq 0 ]]; then
205- rm -rf " $region_dir " /8810
206- cp -R " $region_dir " /8810.old " $region_dir " /8810
206+ rm -rf " $REGION_ROOT " /8810
207+ cp -R " $REGION_ROOT " /8810.old " $REGION_ROOT " /8810
207208 elif [[ $choice -eq 1 ]]; then
208- rm -rf " $region_dir " /8820
209- cp -R " $region_dir " /8820.old " $region_dir " /8820
209+ rm -rf " $REGION_ROOT " /8820
210+ cp -R " $REGION_ROOT " /8820.old " $REGION_ROOT " /8820
210211 else
211- rm -rf " $region_dir " /8830
212- cp -R " $region_dir " /8830.old " $region_dir " /8830
212+ rm -rf " $REGION_ROOT " /8830
213+ cp -R " $REGION_ROOT " /8830.old " $REGION_ROOT " /8830
213214 fi
214215 echo " $( date) regions moved, current dump outputs:" >> " $test_log "
215- $cds dump --no-color -d " $region_dir " /8810 \
216- -d " $region_dir " /8820 \
217- -d " $region_dir " /8830 >> " $test_log " 2>&1
216+ $cds dump --no-color -d " $REGION_ROOT " /8810 \
217+ -d " $REGION_ROOT " /8820 \
218+ -d " $REGION_ROOT " /8830 >> " $test_log " 2>&1
218219
219220 echo " $( date) resume downstairs" >> " $test_log "
220221 bring_all_downstairs_online
@@ -236,7 +237,7 @@ while [[ $count -le $loops ]]; do
236237 (( err += 1 ))
237238 duration=$SECONDS
238239 printf " [%03d] Error $result in one test after %d:%02d\n" " $count " \
239- $(( duration / 60 )) $(( duration % 60 )) | tee -a ${ loop_log}
240+ $(( duration / 60 )) $(( duration % 60 )) | tee -a " $ loop_log"
240241 mv " $test_log " " $test_log " .lastfail
241242 break
242243 fi
@@ -249,7 +250,7 @@ while [[ $count -le $loops ]]; do
249250 printf " [%03d/%03d] %d:%02d ave:%d:%02d total:%d:%02d errors:%d \
250251last_run_seconds:%d\n" " $count " " $loops " $(( duration / 60 )) $(( duration % 60 )) \
251252$(( ave / 60 )) $(( ave % 60 )) $(( total / 60 )) $(( total % 60 )) \
252- " $err " $duration | tee -a ${ loop_log}
253+ " $err " $duration | tee -a " $ loop_log"
253254 (( count += 1 ))
254255
255256done
@@ -258,11 +259,10 @@ if [[ -n "$dsc_pid" ]]; then
258259 wait " $dsc_pid "
259260fi
260261
261- echo " Final results $( date) :" | tee -a ${ loop_log}
262+ echo " Final results $( date) :" | tee -a " $ loop_log"
262263printf " [%03d] %d:%02d ave:%d:%02d total:%d:%02d errors:%d last_run_seconds:%d\n" \
263264 " $count " $(( duration / 60 )) $(( duration % 60 )) \
264265 $(( ave / 60 )) $(( ave % 60 )) \
265266 $(( total / 60 )) $(( total % 60 )) \
266- " $err " $duration | tee -a ${ loop_log}
267+ " $err " $duration | tee -a " $ loop_log"
267268exit " $err "
268-
0 commit comments