Commit 574367b9 authored by rich prohaska's avatar rich prohaska

#45 add the air traffic ontime test

parent 345b87cf
CREATE TABLE `ontime` (
`Year` year(4) DEFAULT NULL,
`Quarter` tinyint(4) DEFAULT NULL,
`Month` tinyint(4) DEFAULT NULL,
`DayofMonth` tinyint(4) DEFAULT NULL,
`DayOfWeek` tinyint(4) DEFAULT NULL,
`FlightDate` date DEFAULT NULL,
`UniqueCarrier` char(7) DEFAULT NULL,
`AirlineID` int(11) DEFAULT NULL,
`Carrier` char(2) DEFAULT NULL,
`TailNum` varchar(50) DEFAULT NULL,
`FlightNum` varchar(10) DEFAULT NULL,
`Origin` char(5) DEFAULT NULL,
`OriginCityName` varchar(100) DEFAULT NULL,
`OriginState` char(2) DEFAULT NULL,
`OriginStateFips` varchar(10) DEFAULT NULL,
`OriginStateName` varchar(100) DEFAULT NULL,
`OriginWac` int(11) DEFAULT NULL,
`Dest` char(5) DEFAULT NULL,
`DestCityName` varchar(100) DEFAULT NULL,
`DestState` char(2) DEFAULT NULL,
`DestStateFips` varchar(10) DEFAULT NULL,
`DestStateName` varchar(100) DEFAULT NULL,
`DestWac` int(11) DEFAULT NULL,
`CRSDepTime` int(11) DEFAULT NULL,
`DepTime` int(11) DEFAULT NULL,
`DepDelay` int(11) DEFAULT NULL,
`DepDelayMinutes` int(11) DEFAULT NULL,
`DepDel15` int(11) DEFAULT NULL,
`DepartureDelayGroups` int(11) DEFAULT NULL,
`DepTimeBlk` varchar(20) DEFAULT NULL,
`TaxiOut` int(11) DEFAULT NULL,
`WheelsOff` int(11) DEFAULT NULL,
`WheelsOn` int(11) DEFAULT NULL,
`TaxiIn` int(11) DEFAULT NULL,
`CRSArrTime` int(11) DEFAULT NULL,
`ArrTime` int(11) DEFAULT NULL,
`ArrDelay` int(11) DEFAULT NULL,
`ArrDelayMinutes` int(11) DEFAULT NULL,
`ArrDel15` int(11) DEFAULT NULL,
`ArrivalDelayGroups` int(11) DEFAULT NULL,
`ArrTimeBlk` varchar(20) DEFAULT NULL,
`Cancelled` tinyint(4) DEFAULT NULL,
`CancellationCode` char(1) DEFAULT NULL,
`Diverted` tinyint(4) DEFAULT NULL,
`CRSElapsedTime` INT(11) DEFAULT NULL,
`ActualElapsedTime` INT(11) DEFAULT NULL,
`AirTime` INT(11) DEFAULT NULL,
`Flights` INT(11) DEFAULT NULL,
`Distance` INT(11) DEFAULT NULL,
`DistanceGroup` TINYINT(4) DEFAULT NULL,
`CarrierDelay` INT(11) DEFAULT NULL,
`WeatherDelay` INT(11) DEFAULT NULL,
`NASDelay` INT(11) DEFAULT NULL,
`SecurityDelay` INT(11) DEFAULT NULL,
`LateAircraftDelay` INT(11) DEFAULT NULL,
`FirstDepTime` varchar(10) DEFAULT NULL,
`TotalAddGTime` varchar(10) DEFAULT NULL,
`LongestAddGTime` varchar(10) DEFAULT NULL,
`DivAirportLandings` varchar(10) DEFAULT NULL,
`DivReachedDest` varchar(10) DEFAULT NULL,
`DivActualElapsedTime` varchar(10) DEFAULT NULL,
`DivArrDelay` varchar(10) DEFAULT NULL,
`DivDistance` varchar(10) DEFAULT NULL,
`Div1Airport` varchar(10) DEFAULT NULL,
`Div1WheelsOn` varchar(10) DEFAULT NULL,
`Div1TotalGTime` varchar(10) DEFAULT NULL,
`Div1LongestGTime` varchar(10) DEFAULT NULL,
`Div1WheelsOff` varchar(10) DEFAULT NULL,
`Div1TailNum` varchar(10) DEFAULT NULL,
`Div2Airport` varchar(10) DEFAULT NULL,
`Div2WheelsOn` varchar(10) DEFAULT NULL,
`Div2TotalGTime` varchar(10) DEFAULT NULL,
`Div2LongestGTime` varchar(10) DEFAULT NULL,
`Div2WheelsOff` varchar(10) DEFAULT NULL,
`Div2TailNum` varchar(10) DEFAULT NULL,
`Div3Airport` varchar(10) DEFAULT NULL,
`Div3WheelsOn` varchar(10) DEFAULT NULL,
`Div3TotalGTime` varchar(10) DEFAULT NULL,
`Div3LongestGTime` varchar(10) DEFAULT NULL,
`Div3WheelsOff` varchar(10) DEFAULT NULL,
`Div3TailNum` varchar(10) DEFAULT NULL,
`Div4Airport` varchar(10) DEFAULT NULL,
`Div4WheelsOn` varchar(10) DEFAULT NULL,
`Div4TotalGTime` varchar(10) DEFAULT NULL,
`Div4LongestGTime` varchar(10) DEFAULT NULL,
`Div4WheelsOff` varchar(10) DEFAULT NULL,
`Div4TailNum` varchar(10) DEFAULT NULL,
`Div5Airport` varchar(10) DEFAULT NULL,
`Div5WheelsOn` varchar(10) DEFAULT NULL,
`Div5TotalGTime` varchar(10) DEFAULT NULL,
`Div5LongestGTime` varchar(10) DEFAULT NULL,
`Div5WheelsOff` varchar(10) DEFAULT NULL,
`Div5TailNum` varchar(10) DEFAULT NULL
) ENGINE=TOKUDB;
\ No newline at end of file
CREATE TABLE `ontime` (
`Year` year(4) DEFAULT NULL,
`Quarter` tinyint(4) DEFAULT NULL,
`Month` tinyint(4) DEFAULT NULL,
`DayofMonth` tinyint(4) DEFAULT NULL,
`DayOfWeek` tinyint(4) DEFAULT NULL,
`FlightDate` date DEFAULT NULL,
`UniqueCarrier` char(7) DEFAULT NULL,
`AirlineID` int(11) DEFAULT NULL,
`Carrier` char(2) DEFAULT NULL,
`TailNum` varchar(50) DEFAULT NULL,
`FlightNum` varchar(10) DEFAULT NULL,
`Origin` char(5) DEFAULT NULL,
`OriginCityName` varchar(100) DEFAULT NULL,
`OriginState` char(2) DEFAULT NULL,
`OriginStateFips` varchar(10) DEFAULT NULL,
`OriginStateName` varchar(100) DEFAULT NULL,
`OriginWac` int(11) DEFAULT NULL,
`Dest` char(5) DEFAULT NULL,
`DestCityName` varchar(100) DEFAULT NULL,
`DestState` char(2) DEFAULT NULL,
`DestStateFips` varchar(10) DEFAULT NULL,
`DestStateName` varchar(100) DEFAULT NULL,
`DestWac` int(11) DEFAULT NULL,
`CRSDepTime` int(11) DEFAULT NULL,
`DepTime` int(11) DEFAULT NULL,
`DepDelay` int(11) DEFAULT NULL,
`DepDelayMinutes` int(11) DEFAULT NULL,
`DepDel15` int(11) DEFAULT NULL,
`DepartureDelayGroups` int(11) DEFAULT NULL,
`DepTimeBlk` varchar(20) DEFAULT NULL,
`TaxiOut` int(11) DEFAULT NULL,
`WheelsOff` int(11) DEFAULT NULL,
`WheelsOn` int(11) DEFAULT NULL,
`TaxiIn` int(11) DEFAULT NULL,
`CRSArrTime` int(11) DEFAULT NULL,
`ArrTime` int(11) DEFAULT NULL,
`ArrDelay` int(11) DEFAULT NULL,
`ArrDelayMinutes` int(11) DEFAULT NULL,
`ArrDel15` int(11) DEFAULT NULL,
`ArrivalDelayGroups` int(11) DEFAULT NULL,
`ArrTimeBlk` varchar(20) DEFAULT NULL,
`Cancelled` tinyint(4) DEFAULT NULL,
`CancellationCode` char(1) DEFAULT NULL,
`Diverted` tinyint(4) DEFAULT NULL,
`CRSElapsedTime` INT(11) DEFAULT NULL,
`ActualElapsedTime` INT(11) DEFAULT NULL,
`AirTime` INT(11) DEFAULT NULL,
`Flights` INT(11) DEFAULT NULL,
`Distance` INT(11) DEFAULT NULL,
`DistanceGroup` TINYINT(4) DEFAULT NULL,
`CarrierDelay` INT(11) DEFAULT NULL,
`WeatherDelay` INT(11) DEFAULT NULL,
`NASDelay` INT(11) DEFAULT NULL,
`SecurityDelay` INT(11) DEFAULT NULL,
`LateAircraftDelay` INT(11) DEFAULT NULL,
`FirstDepTime` varchar(10) DEFAULT NULL,
`TotalAddGTime` varchar(10) DEFAULT NULL,
`LongestAddGTime` varchar(10) DEFAULT NULL,
`DivAirportLandings` varchar(10) DEFAULT NULL,
`DivReachedDest` varchar(10) DEFAULT NULL,
`DivActualElapsedTime` varchar(10) DEFAULT NULL,
`DivArrDelay` varchar(10) DEFAULT NULL,
`DivDistance` varchar(10) DEFAULT NULL,
`Div1Airport` varchar(10) DEFAULT NULL,
`Div1WheelsOn` varchar(10) DEFAULT NULL,
`Div1TotalGTime` varchar(10) DEFAULT NULL,
`Div1LongestGTime` varchar(10) DEFAULT NULL,
`Div1WheelsOff` varchar(10) DEFAULT NULL,
`Div1TailNum` varchar(10) DEFAULT NULL,
`Div2Airport` varchar(10) DEFAULT NULL,
`Div2WheelsOn` varchar(10) DEFAULT NULL,
`Div2TotalGTime` varchar(10) DEFAULT NULL,
`Div2LongestGTime` varchar(10) DEFAULT NULL,
`Div2WheelsOff` varchar(10) DEFAULT NULL,
`Div2TailNum` varchar(10) DEFAULT NULL,
`Div3Airport` varchar(10) DEFAULT NULL,
`Div3WheelsOn` varchar(10) DEFAULT NULL,
`Div3TotalGTime` varchar(10) DEFAULT NULL,
`Div3LongestGTime` varchar(10) DEFAULT NULL,
`Div3WheelsOff` varchar(10) DEFAULT NULL,
`Div3TailNum` varchar(10) DEFAULT NULL,
`Div4Airport` varchar(10) DEFAULT NULL,
`Div4WheelsOn` varchar(10) DEFAULT NULL,
`Div4TotalGTime` varchar(10) DEFAULT NULL,
`Div4LongestGTime` varchar(10) DEFAULT NULL,
`Div4WheelsOff` varchar(10) DEFAULT NULL,
`Div4TailNum` varchar(10) DEFAULT NULL,
`Div5Airport` varchar(10) DEFAULT NULL,
`Div5WheelsOn` varchar(10) DEFAULT NULL,
`Div5TotalGTime` varchar(10) DEFAULT NULL,
`Div5LongestGTime` varchar(10) DEFAULT NULL,
`Div5WheelsOff` varchar(10) DEFAULT NULL,
`Div5TailNum` varchar(10) DEFAULT NULL,
KEY `Year` (`Year`,`Month`),
KEY `Year_2` (`Year`,`DayOfWeek`),
KEY `Year_3` (`Year`,`DepDelay`,`DayOfWeek`),
KEY `DayOfWeek` (`DayOfWeek`,`Year`,`DepDelay`),
KEY `Year_4` (`Year`,`DepDelay`,`Origin`,`Carrier`),
KEY `DepDelay` (`DepDelay`,`Year`),
KEY `Year_5` (`Year`,`DestCityName`,`OriginCityName`),
KEY `DestCityName` (`DestCityName`,`OriginCityName`,`Year`)
) ENGINE=TOKUDB;
\ No newline at end of file
# Q8: As final I tested most popular destination in sense count of direct connected cities for different diapason of years.
SELECT DestCityName, COUNT( OriginCityName) FROM ontime WHERE Year BETWEEN 2006 and 2007 GROUP BY DestCityName ORDER BY 2 DESC LIMIT 10;
select avg(c1) from (select year,month,count(*) as c1 from ontime group by YEAR,month) t;
DayOfWeek c
5 8732424
1 8730614
4 8710843
3 8685626
2 8639632
7 8274367
6 7514194
SELECT DayOfWeek, count(*) AS c FROM ontime WHERE Year BETWEEN 2000 AND 2008 GROUP BY DayOfWeek ORDER BY c DESC;
DayOfWeek c
5 2088300
4 1918325
1 1795120
7 1782292
3 1640798
2 1538291
6 1391984
SELECT DayOfWeek, count(*) AS c FROM ontime WHERE DepDelay>10 AND Year BETWEEN 2000 AND 2008 GROUP BY DayOfWeek ORDER BY c DESC;
Origin c
ORD 846692
ATL 822955
DFW 601318
LAX 391247
PHX 391191
LAS 351713
DEN 345108
EWR 292916
DTW 289233
IAH 283861
SELECT Origin, count(*) AS c FROM ontime WHERE DepDelay>10 AND Year BETWEEN 2000 AND 2008 GROUP BY Origin ORDER BY c DESC LIMIT 10;
carrier count(*)
WN 296293
AA 176203
MQ 145630
US 135987
UA 128174
OO 127426
EV 101796
XE 99915
DL 93675
NW 90429
CO 76662
YV 67905
FL 59460
OH 59034
B6 50740
9E 46948
AS 42830
F9 23035
AQ 4299
HA 2746
SELECT carrier, count(*) FROM ontime WHERE DepDelay>10 AND Year=2007 GROUP BY carrier ORDER BY 2 DESC;
carrier c c2 c3
EV 101796 286234 355.6391
US 135987 485447 280.1274
AA 176203 633857 277.9854
MQ 145630 540494 269.4387
AS 42830 160185 267.3783
B6 50740 191450 265.0300
UA 128174 490002 261.5785
WN 296293 1168871 253.4865
OH 59034 236032 250.1102
CO 76662 323151 237.2327
F9 23035 97760 235.6281
YV 67905 294362 230.6853
XE 99915 434773 229.8096
FL 59460 263159 225.9471
NW 90429 414526 218.1504
OO 127426 597880 213.1297
DL 93675 475889 196.8421
9E 46948 258851 181.3707
AQ 4299 46360 92.7308
HA 2746 56175 48.8830
SELECT t.carrier, c, c2, c*1000/c2 as c3 FROM (SELECT carrier, count(*) AS c FROM ontime WHERE DepDelay>10 AND Year=2007 GROUP BY carrier) t JOIN (SELECT carrier, count(*) AS c2 FROM ontime WHERE Year=2007 GROUP BY carrier) t2 ON (t.Carrier=t2.Carrier) ORDER BY c3 DESC;
carrier c c2 c3
UA 1096646 490002 2238.0439
AS 354145 160185 2210.8500
DL 1050448 475889 2207.3383
AA 1276555 633857 2013.9479
US 909154 485447 1872.8182
WN 2165483 1168871 1852.6279
NW 725076 414526 1749.1689
MQ 876799 540494 1622.2178
CO 522219 323151 1616.0216
EV 461050 286234 1610.7451
OH 301681 236032 1278.1360
FL 298916 263159 1135.8760
B6 197249 191450 1030.2899
OO 556247 597880 930.3656
F9 72150 97760 738.0319
YV 198787 294362 675.3147
XE 233488 434773 537.0343
AQ 17239 46360 371.8507
9E 89391 258851 345.3377
HA 15968 56175 284.2546
SELECT t.carrier, c, c2, c*1000/c2 as c3 FROM (SELECT carrier, count(*) AS c FROM ontime WHERE DepDelay>10 AND Year BETWEEN 2000 and 2008 GROUP BY carrier) t JOIN (SELECT carrier, count(*) AS c2 FROM ontime WHERE Year=2007 GROUP BY carrier) t2 ON (t.Carrier=t2.Carrier) ORDER BY c3 DESC;
Year c1/c2
1988 166.1709
1989 199.5009
1990 166.4513
1991 147.2163
1992 146.7543
1993 154.2498
1994 165.6803
1995 193.9344
1996 221.8281
1997 191.6513
1998 193.5638
1999 200.8742
2000 231.7167
2001 189.0581
2002 162.3769
2003 150.2455
2004 192.4838
2005 207.5929
2006 231.5599
2007 245.3487
2008 219.9228
SELECT t.Year, c1/c2 FROM (select Year,count(*)*1000 as c1 from ontime WHERE DepDelay>10 GROUP BY Year) t JOIN (select Year,count(*) as c2 from ontime GROUP BY Year) t2 ON (t.Year=t2.Year);
DestCityName COUNT( DISTINCT OriginCityName)
Atlanta, GA 190
Chicago, IL 159
Dallas/Ft.Worth, TX 151
Cincinnati, OH 139
Minneapolis, MN 131
Houston, TX 127
Detroit, MI 121
Denver, CO 120
Salt Lake City, UT 116
New York, NY 111
SELECT DestCityName, COUNT( DISTINCT OriginCityName) FROM ontime FORCE INDEX(DestCityName) WHERE Year BETWEEN 1999 and 2009 GROUP BY DestCityName ORDER BY 2 DESC LIMIT 10;
DestCityName COUNT( DISTINCT OriginCityName)
Atlanta, GA 190
Chicago, IL 159
Dallas/Ft.Worth, TX 151
Cincinnati, OH 139
Minneapolis, MN 131
Houston, TX 127
Detroit, MI 121
Denver, CO 120
Salt Lake City, UT 116
New York, NY 111
SELECT DestCityName, COUNT( DISTINCT OriginCityName) FROM ontime WHERE Year BETWEEN 1999 and 2009 GROUP BY DestCityName ORDER BY 2 DESC LIMIT 10;
SELECT DestCityName, COUNT( DISTINCT OriginCityName) FROM ontime WHERE Year BETWEEN 1999 and 1999 GROUP BY DestCityName ORDER BY 2 DESC LIMIT 10;
SELECT DestCityName, COUNT( DISTINCT OriginCityName) FROM ontime USE INDEX(year_5) WHERE Year BETWEEN 1999 and 1999 GROUP BY DestCityName ORDER BY 2 DESC LIMIT 10;
SELECT DestCityName, COUNT( DISTINCT OriginCityName) FROM ontime WHERE Year BETWEEN 1999 and 2000 GROUP BY DestCityName ORDER BY 2 DESC LIMIT 10;
SELECT DestCityName, COUNT( DISTINCT OriginCityName) FROM ontime WHERE Year BETWEEN 1999 and 2001 GROUP BY DestCityName ORDER BY 2 DESC LIMIT 10;
SELECT DestCityName, COUNT( DISTINCT OriginCityName) FROM ontime WHERE Year BETWEEN 1999 and 2002 GROUP BY DestCityName ORDER BY 2 DESC LIMIT 10;
DestCityName COUNT( DISTINCT OriginCityName)
Atlanta, GA 183
Chicago, IL 147
Dallas/Ft.Worth, TX 133
Cincinnati, OH 129
Minneapolis, MN 128
Houston, TX 114
Detroit, MI 112
Denver, CO 111
Salt Lake City, UT 108
New York, NY 101
SELECT DestCityName, COUNT( DISTINCT OriginCityName) FROM ontime WHERE Year BETWEEN 2006 and 2007 GROUP BY DestCityName ORDER BY 2 DESC LIMIT 10;
SELECT DestCityName, COUNT( DISTINCT OriginCityName) FROM ontime use index(year_5) WHERE Year BETWEEN 2006 and 2007 GROUP BY DestCityName ORDER BY 2 DESC LIMIT 10;
year c1
1988 5202096
1989 5041200
1990 5270893
1991 5076925
1992 5092157
1993 5070501
1994 5180048
1995 5327435
1996 5351983
1997 5411843
1998 5384721
1999 5527884
2000 5683047
2001 5967780
2002 5271359
2003 6488540
2004 7129270
2005 7140596
2006 7141922
2007 7455458
2008 7009728
select year,count(*) as c1 from ontime group by YEAR;
select count(*) from ontime use index();
select count(*) from ontime;
#!/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
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)
if [ $tokudb_load_save_space -ne 0 ] ; then
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
else
mysql -S $mysqlsocket -u $mysqluser -D $dbname -e "load data infile '$basedir/atc_On_Time_Performance.mysql.csv' into table $tblname" >>$runfile 2>&1
fi
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment