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.
84 lines
2.1 KiB
84 lines
2.1 KiB
3 years ago
|
#!/bin/bash
|
||
|
set -e
|
||
|
echo "**********************"
|
||
|
echo "** rollout gen_data **"
|
||
|
echo "**********************"
|
||
|
PWD=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||
|
if [[ ! -d "data" && ! -L "data" ]]; then
|
||
|
mkdir data
|
||
|
fi
|
||
|
source $PWD/../functions.sh
|
||
|
|
||
|
GEN_DATA_SCALE=$1
|
||
|
EXPLAIN_ANALYZE=$2
|
||
|
RANDOM_DISTRIBUTION=$3
|
||
|
MULTI_USER_COUNT=$4
|
||
|
SINGLE_USER_ITERATIONS=$5
|
||
|
VERSION=$6
|
||
|
|
||
|
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
|
||
|
|
||
|
gen_data()
|
||
|
{
|
||
|
# Jeder core wird benutzt, um parallel Daten zu generieren
|
||
|
PARALLEL=$(lscpu --parse=cpu | grep -v "#" | wc -l)
|
||
|
if [ "$PARALLEL" -gt "8" ]; then
|
||
|
PARALLEL=$(($PARALLEL - 5))
|
||
|
fi
|
||
|
echo "parallel: $PARALLEL"
|
||
|
CHILD="0"
|
||
|
for x in $(seq 1 $PARALLEL); do
|
||
|
CHILD=$(($CHILD + 1))
|
||
|
GEN_DATA_PATH="$PWD""/data""/psqldata_""$CHILD"
|
||
|
echo "GEN_DATA_PATH is $GEN_DATA_PATH"
|
||
|
mylogfile=$PWD/../log/generate_data.$CHILD.log
|
||
|
$PWD/generate_data.sh $GEN_DATA_SCALE $CHILD $PARALLEL $GEN_DATA_PATH > $mylogfile 2>&1 < $mylogfile &
|
||
|
done
|
||
|
}
|
||
|
get_count_generate_data()
|
||
|
{
|
||
|
count="0"
|
||
|
#for i in $(cat $PWD/../segment_hosts.txt); do
|
||
|
next_count=$(ps -ef | grep generate_data.sh | grep -v grep | wc -l 2>&1 || true)
|
||
|
check="^[0-9]+$"
|
||
|
if ! [[ $next_count =~ $check ]] ; then
|
||
|
next_count="1"
|
||
|
fi
|
||
|
count=$(($count + $next_count))
|
||
|
#done
|
||
|
}
|
||
|
|
||
|
step=gen_data
|
||
|
init_log $step
|
||
|
start_log
|
||
|
schema_name="tpch"
|
||
|
table_name="gen_data"
|
||
|
|
||
|
echo "gen_data"
|
||
|
gen_data
|
||
|
|
||
|
echo ""
|
||
|
get_count_generate_data
|
||
|
echo "Now generating data. This may take a while."
|
||
|
echo -ne "Generating data"
|
||
|
while [ "$count" -gt "0" ]; do
|
||
|
echo -ne "."
|
||
|
sleep 5
|
||
|
get_count_generate_data
|
||
|
done
|
||
|
|
||
|
echo "Done generating data"
|
||
|
echo ""
|
||
|
|
||
|
echo "Generate queries"
|
||
|
cd $PWD
|
||
|
$PWD/generate_queries.sh
|
||
|
|
||
|
log
|
||
|
|
||
|
end_step $step
|