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.
79 lines
3.3 KiB
79 lines
3.3 KiB
#!/bin/bash
|
|
set -e
|
|
echo "*****************"
|
|
echo "** ddl rollout **"
|
|
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
|
|
# holds server_certificate for exasol and master node port for cratedb
|
|
UTIL=$7
|
|
|
|
if [[ "$GEN_DATA_SCALE" == "" || "$EXPLAIN_ANALYZE" == "" || "$RANDOM_DISTRIBUTION" == "" || "$MULTI_USER_COUNT" == "" || "$SINGLE_USER_ITERATIONS" == "" ]]; 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, and the number of sql iterations."
|
|
echo "Example: ./rollout.sh 100 false false 5 1"
|
|
exit 1
|
|
fi
|
|
|
|
step=ddl
|
|
init_log $step
|
|
|
|
# Entfernen vom alten Benchmark-Schema (und der zugehörigen Tabellen) und neues erstellen
|
|
if [ "$VERSION" == "postgresql" ] || [ "$VERSION" == "gpdb" ]; then
|
|
filter="postgresql"
|
|
setup="$PWD/$VERSION/postgresql.setup.sql"
|
|
psql -h localhost -p 5439 -U p -d benchmark -v ON_ERROR_STOP=1 -q -a -P pager=off -f $setup
|
|
elif [ "$VERSION" == "exasol" ]; then
|
|
filter="exasol"
|
|
setup="$PWD/$VERSION/exasol.setup.sql"
|
|
$parentPWD/EXAplus-7.1.2/exaplus -c localhost/$UTIL:8563 -u sys -p exasol -f $setup
|
|
elif [ "$VERSION" == "ignite" ]; then
|
|
filter="ignite"
|
|
setup="$PWD/$VERSION/ignite.setup.sql"
|
|
source $PWD/../apache-ignite-2.11.0-bin/bin/sqlline.sh -u jdbc:ignite:thin://127.0.0.1/ -n ignite -p ignite --run=$setup
|
|
elif [ "$VERSION" == "cratedb" ]; then
|
|
filter="cratedb"
|
|
# In cratedb können keine Schemata explizit angelegt werden. Sie sind stattdessen Teil der Tabellen: CREATE TABLE TPCH.LINEITEM...
|
|
elif [ "$VERSION" == "mariadbcs" ]; then
|
|
filter="postgresql"
|
|
setup="$PWD/$VERSION/postgresql.setup.sql"
|
|
mariadb --protocol tcp --host localhost -u nsc --password=mariadbcs < $setup
|
|
else
|
|
echo "ERROR: Unsupported VERSION $VERSION!"
|
|
exit 1
|
|
fi
|
|
|
|
# Anlegen der Tabellen des Benchmarks
|
|
# Dazu wird über alle .sql-Dateien der entsprechenden Datenbank (filter) itertiert, die die CREATE-Anweisungen für die Tabellen beinhalten
|
|
# Zum Erstellen anderer Tabellen können diese Dateien einfach ausgetauscht werden
|
|
for i in $(ls $PWD/$VERSION/*.$filter.*.sql); do
|
|
table_name=$(echo $i | awk -F '.' '{print $3}')
|
|
start_log
|
|
echo "Creating table $table_name."
|
|
if [ "$VERSION" == "postgresql" ] || [ "$VERSION" == "gpdb" ]; then
|
|
psql -h localhost -p 5439 -U p -d benchmark -v ON_ERROR_STOP=1 -q -a -P pager=off -f $i
|
|
elif [ "$VERSION" == "exasol" ]; then
|
|
$parentPWD/EXAplus-7.1.2/exaplus -c localhost/$UTIL:8563 -u sys -p exasol -f $i
|
|
elif [ "$VERSION" == "ignite" ]; then
|
|
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
|
|
elif [ "$VERSION" == "cratedb" ]; then
|
|
# crash-cli, CrateDBs command line tool, besitzt nicht die Möglichkeit direkt Dateien einzulesen, weshalb hier explizit die query übergeben werden muss
|
|
query=$(cat $i)
|
|
$parentPWD/crash-cli/crash --hosts "localhost:$UTIL" -c "drop table if exists tpch.$table_name;"
|
|
$parentPWD/crash-cli/crash --hosts "localhost:$UTIL" -c "$query"
|
|
elif [ "$VERSION" == "mariadbcs" ]; then
|
|
mariadb --protocol tcp --host localhost -u nsc --password=mariadbcs < $i
|
|
fi
|
|
|
|
|
|
log
|
|
done
|
|
|
|
end_step $step
|
|
|