blob: 9727f35ba28c86f8f2fc4cd8ce4704b1178cf06c (
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
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
|
#!/usr/bin/env bash
function usage() {
echo "run the atc ontime load and run"
echo "--mysqlbuild=$mysqlbuild"
echo "[--commit=$commit]"
echo "[--dbname=$dbname]"
echo "[--load=$load] [--check=$check] [--run=$run]"
echo "[--engine=$engine]"
echo "[--tokudb_load_save_space=$tokudb_load_save_space]"
}
function retry() {
local cmd
local retries
local exitcode
cmd=$*
let retries=0
while [ $retries -le 10 ] ; do
echo `date` $cmd
bash -c "$cmd"
exitcode=$?
echo `date` $cmd $exitcode $retries
let retries=retries+1
if [ $exitcode -eq 0 ] ; then break; fi
sleep 10
done
test $exitcode = 0
}
mysqlbuild=
commit=0
mysqlserver=`hostname`
mysqluser=`whoami`
mysqlsocket=/tmp/mysql.sock
svnserver=https://svn.tokutek.com/tokudb
basedir=$HOME/svn.build
builddir=$basedir/mysql.build
dbname=atc
tblname=ontime
load=1
check=1
run=1
engine=tokudb
tokudb_load_save_space=0
verbose=0
svn_server=https://svn.tokutek.com/tokudb
svn_branch=.
svn_revision=HEAD
# parse the command line
while [ $# -gt 0 ] ; do
arg=$1; shift
if [[ $arg =~ --(.*)=(.*) ]] ; then
eval ${BASH_REMATCH[1]}=${BASH_REMATCH[2]}
else
usage; exit 1
fi
done
if [[ $mysqlbuild =~ (.*)-(tokudb\-.*)-(linux)-(x86_64) ]] ; then
mysql=${BASH_REMATCH[1]}
tokudb=${BASH_REMATCH[2]}
system=${BASH_REMATCH[3]}
arch=${BASH_REMATCH[4]}
else
exit 1
fi
if [ -d /usr/local/mysql/bin ] ; then
export PATH=/usr/local/mysql/bin:$PATH
fi
if [ -d /usr/local/mysql/lib/mysql ] ; then
export LD_LIBRARY_PATH=/usr/local/mysql/lib/mysql:$PATH
fi
# goto the base directory
if [ ! -d $basedir ] ; then mkdir $basedir; fi
pushd $basedir
# update the build directory
if [ ! -d $builddir ] ; then mkdir $builddir; fi
date=`date +%Y%m%d`
testresultsdir=$builddir/$date
pushd $builddir
while [ ! -d $date ] ; do
svn mkdir $svn_server/mysql.build/$date -m ""
svn checkout $svn_server/mysql.build/$date
if [ $? -ne 0 ] ; then rm -rf $date; fi
done
popd
if [ $dbname = "atc" -a $engine != "tokudb" ] ; then dbname="atc_$engine"; fi
runfile=$testresultsdir/$dbname-$tblname-$mysqlbuild-$mysqlserver
if [ $tokudb_load_save_space != 0 ] ; then runfile=$runfile-compress; fi
rm -rf $runfile
testresult="PASS"
# maybe get the atc data from s3
if [ $testresult = "PASS" ] ; then
f=atc_On_Time_Performance.mysql.csv
if [ ! -f $f ] ; then
f=$f.gz
if [ ! -f $f ] ; then
echo `date` s3get --bundle tokutek-mysql-data $f >>$runfile 2>&1
s3get --verbose --bundle tokutek-mysql-data $f >>$runfile 2>&1
exitcode=$?
echo `date` s3get --bundle tokutek-mysql-data $f $exitcode >>$runfile 2>&1
if [ $exitcode -ne 0 ] ; then testresult="FAIL"; fi
if [ $testresult = "PASS" ] ; then
echo `date` gunzip $f >>$runfile 2>&1
gunzip $f
exitcode=$?
echo `date` gunzip $f $exitcode >>$runfile 2>&1
if [ $exitcode -ne 0 ] ; then testresult="FAIL"; fi
fi
fi
fi
fi
# checkout the atc test from svn
atc=atc-$mysqlbuild
if [ $testresult = "PASS" ] ; then
if [ -d atc-$mysqlbuild ] ; then rm -rf atc-$mysqlbuild; fi
retry svn export -r $svn_revision $svn_server/$svn_branch/mysql/tests/atc atc-$mysqlbuild
exitcode=$?
echo `date` svn export -r $svn_revision $svn_server/$svn_branch/mysql/tests/atc $exitcode >>$runfile 2>&1
if [ $exitcode != 0 ] ; then
retry svn export -r $svn_revision $svn_server/mysql/tests/atc atc-$mysqlbuild
exitcode=$?
echo `date` svn export -r $svn_revision $svn_server/mysql/tests/atc $exitcode >>$runfile 2>&1
fi
if [ $exitcode != 0 ] ; then testresult="FAIL"; fi
fi
# create the database
if [ $load -ne 0 -a $testresult = "PASS" ] ; then
echo `date` drop database if exists $dbname >>$runfile
mysql -S $mysqlsocket -u $mysqluser -e "drop database if exists $dbname" >>$runfile 2>&1
exitcode=$?
echo `date` drop database if exists $dbname $exitcode>>$runfile
if [ $exitcode -ne 0 ] ; then testresult="FAIL"; fi
echo `date` create database $dbname >>$runfile
mysql -S $mysqlsocket -u $mysqluser -e "create database $dbname" >>$runfile 2>&1
exitcode=$?
echo `date` create database $dbname $exitcode >>$runfile
if [ $exitcode -ne 0 ] ; then testresult="FAIL"; fi
fi
# create the table
if [ $load -ne 0 -a $testresult = "PASS" ] ; then
echo `date` create table $dbname.$tblname >>$runfile
mysql -S $mysqlsocket -u $mysqluser -D $dbname -e "source $atc/atc_ontime_create_covered.sql" >>$runfile 2>&1
exitcode=$?
echo `date` create table $exitcode >>$runfile
if [ $exitcode -ne 0 ] ; then testresult="FAIL"; fi
fi
if [ $load -ne 0 -a $testresult = "PASS" -a $engine != "tokudb" ] ; then
echo `date` alter table $engine >>$runfile
mysql -S $mysqlsocket -u $mysqluser -D $dbname -e "alter table $tblname engine=$engine" >>$runfile 2>&1
exitcode=$?
echo `date` alter table $engine $exitcode >>$runfile
if [ $exitcode -ne 0 ] ; then testresult="FAIL"; fi
fi
# load the data
if [ $load -ne 0 -a $testresult = "PASS" ] ; then
echo `date` load data >>$runfile
start=$(date +%s)
mysql -S $mysqlsocket -u $mysqluser -D $dbname -e "set tokudb_load_save_space=$tokudb_load_save_space; load data infile '$basedir/atc_On_Time_Performance.mysql.csv' into table $tblname" >>$runfile 2>&1
exitcode=$?
let loadtime=$(date +%s)-$start
echo `date` load data loadtime=$loadtime $exitcode >>$runfile
if [ $exitcode -ne 0 ] ; then testresult="FAIL"; fi
fi
# check the tables
if [ $check -ne 0 -a $testresult = "PASS" ] ; then
echo `date` check table $tblname >> $runfile
mysql -S $mysqlsocket -u $mysqluser -D $dbname -e "check table $tblname" >>$runfile 2>&1
exitcode=$?
echo `date` check table $tblname $exitcode >> $runfile
if [ $exitcode -ne 0 ] ; then testresult="FAIL"; fi
fi
# run the queries
if [ $run -ne 0 -a $testresult = "PASS" ] ; then
pushd $atc
for qfile in q*.sql ; do
if [[ $qfile =~ q(.*)\.sql ]] ; then
qname=${BASH_REMATCH[1]}
q=`cat $qfile`
qrun=q${qname}.run
echo `date` explain $qfile >>$runfile
if [ $verbose -ne 0 ] ; then echo explain $q >>$runfile; fi
mysql -S $mysqlsocket -u $mysqluser -D $dbname -e "explain $q" >$qrun
exitcode=$?
echo `date` explain $qfile $exitcode >>$runfile
if [ $verbose -ne 0 ] ; then cat $qrun >>$runfile; fi
echo `date` $qfile >>$runfile
start=$(date +%s)
if [ $verbose -ne 0 ] ; then echo $q >>$runfile; fi
mysql -S $mysqlsocket -u $mysqluser -D $dbname -e "$q" >$qrun
exitcode=$?
let qtime=$(date +%s)-$start
echo `date` $qfile qtime=$qtime $exitcode >>$runfile
if [ $verbose -ne 0 ] ; then cat $qrun >>$runfile; fi
if [ $exitcode -ne 0 ] ; then
testresult="FAIL"
else
if [ -f q${qname}.result ] ; then
diff $qrun q${qname}.result >>$runfile
exitcode=$?
if [ $exitcode -ne 0 ] ; then
testresult="FAIL"
fi
fi
fi
fi
done
popd
fi
# commit results
if [ $commit != 0 ] ; then
svn add $runfile
retry svn commit -m \"$testresult $dbname $tblname $mysqlbuild $mysqlserver\" $runfile
fi
popd
if [ $testresult = "PASS" ] ; then exitcode=0; else exitcode=1; fi
exit $exitcode
|