summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/test/checkpoint/recovery-test.sh
blob: c776156ddec0c1a08cf31fae4d32f6759b458d15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash

set -x

usage () {
    cat << EOF
Usage: recovery_test.sh {config} {home directory}
EOF
}

if [ "$#" -ne 2 ]; then
    echo "Illegal number of parameters."
    usage
    exit 1
fi

config=$1
home=$2
backup=$home.backup
recovery=$home.recovery

#./t -t r -W 3 -D -X -n 100000 -k 100000 -C cache_size=100MB -h $home > $home.out 2>&1 &
./t ${config} -h ${home} > $home.out 2>&1 &
pid=$!

trap "kill -9 $pid" 0 1 2 3 13 15

# Wait for the test to start running
while ! grep -q "Finished a checkpoint" $home.out && kill -0 $pid ; do
	sleep 1
done

while kill -STOP $pid ; do
	rm -rf $backup $recovery ; mkdir $backup ; mkdir $recovery
	# Make sure all threads are stopped before copying files
	sleep 1
	cp $home/* $backup
	kill -CONT $pid
	cp $backup/* $recovery
	./t -t r -D -v -h $recovery || exit 1
done

# Clean the home directory once the test is completed. Note that once we fail to send the signal to
# stop the test, it means that it is completed.
rm -rf $home $home.out
exit 0