-
Notifications
You must be signed in to change notification settings - Fork 73
/
runset
executable file
·94 lines (82 loc) · 2.69 KB
/
runset
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash
. ./config
. ./params
# Confirm we have a useful pgbench to run
if [ -z $PGBENCHBIN ] || [ ! -x $PGBENCHBIN ]; then
echo ERROR: cannot find pgbench binary $PGBENCHBIN , aborting
exit
fi
TESTPSQL="psql -h $TESTHOST -U $TESTUSER -p $TESTPORT -d $TESTDB"
# See if this database has all the standard pgbench tables in it
PGCOUNT=`$TESTPSQL -A -q -t -c "SELECT count(*) FROM pg_stat_user_tables WHERE relname IN ('pgbench_history','pgbench_tellers','pgbench_accounts','pgbench_branches')"`
if [ "$PGCOUNT" -eq 4 ] ; then
TABLEPREFIX="pgbench_"
PGBENCH_TABLES=1
else
TABLEPREFIX=""
PGCOUNT=`$TESTPSQL -A -q -t -c "SELECT count(*) FROM pg_stat_user_tables WHERE relname IN ('history','tellers','accounts','branches')"`
if [ "$PGCOUNT" -eq 4 ] ; then
PGBENCH_TABLES=1
else
PGBENCH_TABLES=0
fi
fi
# Make sure the configured test script actually exists
if [ ! -f "${TESTDIR}/${SCRIPT}.sql" ]; then
echo "Warning: cannot find test script ${TESTDIR}/${SCRIPT}.sql"
echo "This is normal for internally run initialization steps"
fi
$TESTPSQL -c "CREATE EXTENSION pg_buffercache;"
for SCALE in $SCALES; do
#
# Have a consistent, clean set of pgbench tables to start
# each test run with
#
if [ "$SKIPINIT" -ne "1" ]; then
if [ "$PGBENCH_TABLES" -eq "1" ] ; then
echo Removing old pgbench tables
$TESTPSQL -c "drop table ${TABLEPREFIX}accounts; drop table ${TABLEPREFIX}branches; drop table ${TABLEPREFIX}tellers; drop table ${TABLEPREFIX}history;"
fi
$TESTPSQL -c "vacuum"
echo Creating new pgbench tables scale=$SCALE
if [ -n "$NEWINIT" ] ; then
cp params params.orig
if [ -n "$SERVERSIDE" ] && [ "$SERVERSIDE" -eq "1" ] ; then
echo "SCRIPT=':-i -I dtGvp'" >> params
else
echo "SCRIPT=:-i" >> params
fi
export SCALE && ./benchwarmer 1
cp params.orig params
else
time $PGBENCHBIN -i -s $SCALE -h $TESTHOST -U $TESTUSER -p $TESTPORT $TESTDB
fi
fi
#
# Run the main test
#
for (( t=1; t<=$SETTIMES; t++ )); do
for c in $SETCLIENTS; do
if [ -z "$SETRATES" ] && [ -z "$CLIENTRATES" ] ; then
echo Run set \#$t of $SETTIMES with $c clients scale=$SCALE
./benchwarmer $c
elif [ -z "$CLIENTRATES" ] ; then
for r in $SETRATES; do
echo Run set \#$t of $SETTIMES with $c clients scale=$SCALE rate=$r
./benchwarmer $c $r
done
else
for l in $CLIENTRATES; do
r=`expr $c \* $l`
echo Run set \#$t of $SETTIMES with $c clients @ target=$l scale=$SCALE rate=$r
./benchwarmer $c $r $l
done
fi
echo
done
done
done
echo Generating web report
./webreport
echo runset complete
date