You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
nsc_ba_public/tpch/05_sql/rollout_sql.sh

180 lines
7.7 KiB

#!/bin/bash
set -e
echo "*******************************"
echo "** rollout singleuser queries**"
echo "*******************************"
PWD=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
parentPWD="$(dirname "$PWD")"
source $PWD/../functions.sh
GEN_DATA_SCALE=$1
EXPLAIN_ANALYZE=$2
RANDOM_DISTRIBUTION=$3
MULTI_USER_COUNT=$4
SINGLE_USER_ITERATIONS=$5
VERSION=$6
UTIL=$7
if [[ "$GEN_DATA_SCALE" == "" || "$EXPLAIN_ANALYZE" == "" || "$RANDOM_DISTRIBUTION" == "" || "$MULTI_USER_COUNT" == "" || "$SINGLE_USER_ITERATIONS" == "" || "$VERSION" == "" ]]; then
echo "You must provide the scale as a parameter in terms of Gigabytes, true/false to run queries with EXPLAIN ANALYZE option, true/false to use random distrbution, multi-user count, the number of sql iterations, and the name of the database under test."
echo "Example: ./rollout.sh 100 false false 5 1 exasol"
exit 1
fi
step=sql
init_log $step
# Anlegen eines neuen log files für jeden durchgeführten Lauf.
if [ -f $parentPWD/log/single_run_log.01.txt ]; then
count=$(ls $parentPWD/log | grep 'single_run_log' | wc -l)
count=$((count+1))
if [ "${#count}" == 1 ]; then
touch $parentPWD/log/single_run_log.0$count.txt
logfile=$parentPWD/log/single_run_log.0$count.txt
touch $parentPWD/log/single_run_ressource_log.0$count.txt
ressourcelogfile=$parentPWD/log/single_run_ressource_log.0$count.txt
else
touch $parentPWD/log/single_run_log.$count.txt
logfile=$parentPWD/log/single_run_log.$count.txt
touch $parentPWD/log/single_run_ressource_log.$count.txt
ressourcelogfile=$parentPWD/log/single_run_ressource_log.$count.txt
fi
else
touch $parentPWD/log/single_run_log.01.txt
logfile=$parentPWD/log/single_run_log.01.txt
touch $parentPWD/log/single_run_ressource_log.01.txt
ressourcelogfile=$parentPWD/log/single_run_ressource_log.01.txt
fi
# Logging der beanspruchten Ressourcen. Pid wird benutzt um später den Prozess beenden zu können. top -b -d 1
logging_pid=$(docker stats > $ressourcelogfile & echo $!)
touch $parentPWD/log/single_user_runtime.txt
TOTAL_START=$(date +%s%N)
# Einzelnes Ausführen der Queries und loggen der benötigten Zeit.
if [ "$VERSION" == "postgresql" ] || [ "$VERSION" == "gpdb" ]; then
for x in $(seq 1 $SINGLE_USER_ITERATIONS); do
for i in $(ls $PWD/*.tpch.*.sql); do
id=`echo $i | awk -F '.' '{print $3}'`
start_log
echo "Executing query $id"
STARTTIME=$(date +%s%N)
psql -h localhost -p 5439 -U p -d benchmark -v ON_ERROR_STOP=1 -A -q -t -P pager=off -f $i >> $logfile
ENDTIME=$(date +%s%N)
echo "It takes $((($ENDTIME - $STARTTIME)/1000000)) milliseconds to complete task $id." >> $logfile
echo "Elapsed: $((($ENDTIME - $STARTTIME)/1000000))" >> $logfile
done
done
elif [ "$VERSION" == "exasol" ]; then
for x in $(seq 1 $SINGLE_USER_ITERATIONS); do
for i in $(ls $PWD/*.tpch.*.sql); do
id=`echo $i | awk -F '.' '{print $3}'`
start_log
echo "Executing query $id"
STARTTIME=$(date +%s%N)
$parentPWD/EXAplus-7.1.2/exaplus -c localhost/$UTIL:8563 -u sys -p exasol -q -f $i >> $logfile
ENDTIME=$(date +%s%N)
echo "It takes $((($ENDTIME - $STARTTIME)/1000000)) milliseconds to complete task $id." >> $logfile
echo "Elapsed: $((($ENDTIME - $STARTTIME)/1000000))" >> $logfile
done
done
elif [ "$VERSION" == "ignite" ]; then
for x in $(seq 1 $SINGLE_USER_ITERATIONS); do
for i in $(ls $PWD/*.tpch.*.sql); do
id=`echo $i | awk -F '.' '{print $3}'`
# ignite can't use views and can't execute transformed query either
if [ $id == 13 ] || [ $id == 16 ] || [ $id == 19 ] || [ $id == 20 ] || [ $id == 22 ]; then
echo "skip $id"
else
start_log
echo "Executing query $id"
STARTTIME=$(date +%s%N)
source $PWD/../apache-ignite-2.11.0-bin/bin/sqlline.sh -u jdbc:ignite:thin://127.0.0.1/ -n ignite -p ignite --run=$i >> $logfile
ENDTIME=$(date +%s%N)
echo "It takes $((($ENDTIME - $STARTTIME)/1000000)) milliseconds to complete task $id." >> $logfile
echo "Elapsed: $((($ENDTIME - $STARTTIME)/1000000))" >> $logfile
fi
done
done
elif [ "$VERSION" == "cratedb" ]; then
# Bei den CrateDB queries wurden jeweils ein Limit eingebaut, da bei langen Ergebnissen das Ausgeben sehr lange dauert.
for x in $(seq 1 $SINGLE_USER_ITERATIONS); do
for i in $(ls $PWD/*.tpch.*.sql); do
if ! grep -q ::timestamp "$i"; then
# Einfügen von :: vor timestamp und interval, weil der Query-Generator :: als flag betrachtet zum Einfügen von Werten und diese entfernt.
# (Es werden keine Werte an diesen Stellen eingefügt, weil noch eine Zahl dahinter fehlt, also ::1, ::2, ...)
sed -i -- 's/timestamp/::timestamp/g; s/interval/::interval/g' $i
# Entfernt Kommentar Zeilen (starten mit --), weil CrateDB damit nicht umgehen kann.
sed -i '/^--/d' $i
fi
id=`echo $i | awk -F '.' '{print $3}'`
# CrateDB kann nicht mehrere Anweisungen auf einen Schlag ausführen, es müssen drei einzelne Anweisungen für Query 15 abgesetzt werden.
# 02 syntax
# 05 nach 30 min abgebrochen
# 06 nach 30 min abgebrochen
# 17 kann nicht mit syntax umgehen
# 19 nach 30 min abgebrochen
# 20 kann nicht mit syntax umgehen
# kann nicht mit exists umgehen
if [ $id == 02 ] || [ $id == 05 ] || [ $id == 07 ] || [ $id == 09 ] || [ $id == 13 ] || [ $id == 17 ] || [ $id == 19 ] || [ $id == 20 ] || [ $id == 21 ]; then
# || [ $id == 03 ] || [ $id == 10 ] || [ $id == 04 ] || [ $id == 08 ] || [ $id == 12 ] || [ $id == 16 ]; then
echo "skip $id"
elif [ $id == 15 ]; then
start_log
echo "Executing query $id special"
query_view=$(cat $i)
query_query=$(cat $parentPWD/cratedb_query_15/query_15.sql)
query_delete=$(cat $parentPWD/cratedb_query_15/delete_view_15.sql)
echo "$query_view"
echo "$query_query"
echo "$query_delete"
STARTTIME=$(date +%s%N)
$parentPWD/crash-cli/crash --hosts "localhost:$UTIL" -c "$query_view" >> $logfile
$parentPWD/crash-cli/crash --hosts "localhost:$UTIL" -c "$query_query" >> $logfile
$parentPWD/crash-cli/crash --hosts "localhost:$UTIL" -c "$query_delete" >> $logfile
ENDTIME=$(date +%s%N)
echo "It takes $((($ENDTIME - $STARTTIME)/1000000)) milliseconds to complete task $id." >> $logfile
echo "Elapsed: $((($ENDTIME - $STARTTIME)/1000000))" >> $logfile
else
start_log
echo "Executing query $id"
query=$(cat $i)
echo "$query"
STARTTIME=$(date +%s%N)
$parentPWD/crash-cli/crash --hosts "localhost:$UTIL" -c "$query" >> $logfile
ENDTIME=$(date +%s%N)
echo "It takes $((($ENDTIME - $STARTTIME)/1000000)) milliseconds to complete task $id." >> $logfile
echo "Elapsed: $((($ENDTIME - $STARTTIME)/1000000))" >> $logfile
fi
done
done
elif [ "$VERSION" == "mariadbcs" ]; then
for x in $(seq 1 $SINGLE_USER_ITERATIONS); do
for i in $(ls $PWD/*.tpch.*.sql); do
id=`echo $i | awk -F '.' '{print $3}'`
start_log
if [ $id == 02 ] || [ $id == 05 ] || [ $id == 17 ] || [ $id == 19 ]; then
echo "skip $id"
else
echo "Executing query $id"
STARTTIME=$(date +%s%N)
mariadb --protocol tcp --host localhost -u nsc --password=mariadbcs < $i >> $logfile
ENDTIME=$(date +%s%N)
echo "It takes $((($ENDTIME - $STARTTIME)/1000000)) milliseconds to complete task $id." >> $logfile
echo "Elapsed: $((($ENDTIME - $STARTTIME)/1000000))" >> $logfile
fi
done
done
else
echo "ERROR: Unsupported VERSION $VERSION!"
exit 1
fi
TOTAL_END=$(date +%s%N)
echo "It takes $((($TOTAL_END - $TOTAL_START)/1000000)) milliseconds to complete single user run" >> $parentPWD/log/single_user_runtime.txt
kill -9 $logging_pid
end_step $step