@@ -90,27 +90,28 @@ while getopts 'l:' opt; do
90
90
esac
91
91
done
92
92
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 "
101
102
echo " Tail $test_log for test output"
102
103
echo " Tail $loop_log for summary output"
103
104
echo " Tail $dsc_log for dsc outout"
104
105
105
106
echo " Create a new region to test" | tee -a " ${loop_log} "
106
107
ulimit -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 "
109
110
exit 1
110
111
fi
111
112
112
113
echo " 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 &
114
115
dsc_pid=$!
115
116
# Sleep 5 to give the downstairs time to get going.
116
117
sleep 5
@@ -158,10 +159,10 @@ stop_all_downstairs
158
159
sleep 7
159
160
160
161
# 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
165
166
166
167
# Bring the downstairs back online.
167
168
echo " $( date) Bring downstairs back online" | tee -a " $loop_log "
182
183
echo " Fill completed, wait for downstairs to start restarting" >> " $test_log "
183
184
duration=$SECONDS
184
185
printf " 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"
186
187
187
188
# Now run the repair loop
188
189
count=1
@@ -202,19 +203,19 @@ while [[ $count -le $loops ]]; do
202
203
echo " $( date) move regions" >> " $test_log "
203
204
choice=$(( RANDOM % 3 ))
204
205
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
207
208
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
210
211
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
213
214
fi
214
215
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
218
219
219
220
echo " $( date) resume downstairs" >> " $test_log "
220
221
bring_all_downstairs_online
@@ -236,7 +237,7 @@ while [[ $count -le $loops ]]; do
236
237
(( err += 1 ))
237
238
duration=$SECONDS
238
239
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"
240
241
mv " $test_log " " $test_log " .lastfail
241
242
break
242
243
fi
@@ -249,7 +250,7 @@ while [[ $count -le $loops ]]; do
249
250
printf " [%03d/%03d] %d:%02d ave:%d:%02d total:%d:%02d errors:%d \
250
251
last_run_seconds:%d\n" " $count " " $loops " $(( duration / 60 )) $(( duration % 60 )) \
251
252
$(( ave / 60 )) $(( ave % 60 )) $(( total / 60 )) $(( total % 60 )) \
252
- " $err " $duration | tee -a ${ loop_log}
253
+ " $err " $duration | tee -a " $ loop_log"
253
254
(( count += 1 ))
254
255
255
256
done
@@ -258,11 +259,10 @@ if [[ -n "$dsc_pid" ]]; then
258
259
wait " $dsc_pid "
259
260
fi
260
261
261
- echo " Final results $( date) :" | tee -a ${ loop_log}
262
+ echo " Final results $( date) :" | tee -a " $ loop_log"
262
263
printf " [%03d] %d:%02d ave:%d:%02d total:%d:%02d errors:%d last_run_seconds:%d\n" \
263
264
" $count " $(( duration / 60 )) $(( duration % 60 )) \
264
265
$(( ave / 60 )) $(( ave % 60 )) \
265
266
$(( total / 60 )) $(( total % 60 )) \
266
- " $err " $duration | tee -a ${ loop_log}
267
+ " $err " $duration | tee -a " $ loop_log"
267
268
exit " $err "
268
-
0 commit comments