summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/test/format/s_dumpcmp.sh
blob: 453d42cda32ec0fe20b3f8ab1da8ada3d1e17a6a (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#! /bin/sh

trap 'exit 1' 1 2

top=../..

home="RUNDIR"
wturi="file:wt"

colflag=0
bdbdir=""
while :
	do case "$1" in
	# -b means we need to dump the Berkeley DB database
	-b)
		bdbdir="$2";
		shift ; shift ;;
	# -c means it was a column-store.
	-c)
		colflag=1
		shift ;;
	-h)
		shift ;
		home=$1
		shift;;
	-n)
		shift ;
		wturi=$1
		shift ;;
	*)
		break ;;
	esac
done

if test $# -ne 0; then
	echo 'usage: s_dumpcmp [-bc]' >&2
	exit 1
fi

$top/wt -h $home dump $wturi |
    sed -e '1,/^Data$/d' > $home/wt_dump

if test "X$bdbdir" = "X"; then
	exit 0
fi

if test $colflag -eq 0; then
	$bdbdir/bin/db_dump -p $home/bdb |
	    sed -e '1,/HEADER=END/d' \
		-e '/DATA=END/d' \
		-e 's/^ //' > $home/bdb_dump
else
	# Format stores record numbers in Berkeley DB as string keys,
	# it's simpler that way.  Convert record numbers from strings
	# to numbers.
	$bdbdir/bin/db_dump -p $home/bdb |
	    sed -e '1,/HEADER=END/d' \
		-e '/DATA=END/d' \
		-e 's/^ //' |
	    sed -e 's/^0*//' \
		-e 's/\.00$//' \
		-e N > $home/bdb_dump
fi

cmp $home/wt_dump $home/bdb_dump > /dev/null

exit $?