Skip to content
This repository was archived by the owner on Aug 16, 2021. It is now read-only.

Some code style improvements #68

Merged
merged 17 commits into from
Jul 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ echo "create table hello_world as select i::int4 from generate_series(1, (10^6):
# (seqscan is expected, total time ~150ms, depending on resources)
nancy run \
--run-on localhost \
--db-dump-path file://$(pwd)/sample.dump.bz2 \
--db-dump file://$(pwd)/sample.dump.bz2 \
--tmp-path /tmp \
--workload-custom-sql "select count(1) from hello_world where i between 100000 and 100010;"

# Now check how a regular btree index affects performance
# (expected total time: ~0.05ms)
nancy run \
--run-on localhost \
--db-dump-path file://$(pwd)/sample.dump.bz2 \
--db-dump file://$(pwd)/sample.dump.bz2 \
--tmp-path /tmp \
--workload-custom-sql "select count(1) from hello_world where i between 100000 and 100010;" \
--target-ddl-do "create index i_hello_world_i on hello_world(i);" \
Expand All @@ -128,7 +128,7 @@ nancy run \
--run-on aws \
--aws-ec2-type "i3.large" \
--aws-keypair-name awskey --aws-ssh-key-path file://$(echo ~)/.ssh/awskey.pem \
--db-dump-path "create table a as select i::int4 from generate_series(1, (10^9)::int) _(i);" \
--db-dump "create table a as select i::int4 from generate_series(1, (10^9)::int) _(i);" \
--workload-custom-sql "select count(1) from a where i between 10 and 20;"
```

30 changes: 15 additions & 15 deletions nancy_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ while true; do

Reserved / Not yet implemented.

\033[1m--db-dump-path\033[22m (string)
\033[1m--db-dump\033[22m (string)

Specify the path to database dump (created by pg_dump) to be used as an input.

Expand Down Expand Up @@ -197,7 +197,7 @@ while true; do
--db-prepared-snapshot )
#Still unsupported
DB_PREPARED_SNAPSHOT="$2"; shift 2 ;;
--db-dump-path )
--db-dump )
DB_DUMP_PATH="$2"; shift 2 ;;
--after-db-init-code )
#s3 url|filename|content
Expand Down Expand Up @@ -377,10 +377,16 @@ function checkParams() {
[ ! -z ${WORKLOAD_REAL+x} ] && let workloads_count=$workloads_count+1
[ ! -z ${WORKLOAD_CUSTOM_SQL+x} ] && let workloads_count=$workloads_count+1

#--db-prepared-snapshot or --db-dump
if ([ -z ${DB_PREPARED_SNAPSHOT+x} ] && [ -z ${DB_DUMP_PATH+x} ]); then
>&2 echo "ERROR: The object (database) is not defined."
exit 1;
fi

# --workload-real or --workload-basis-path or --workload-custom-sql
if [ "$workloads_count" -eq "0" ]
then
>&2 echo "ERROR: Workload not given."
>&2 echo "ERROR: The workload is not defined."
exit 1;
fi

Expand All @@ -390,12 +396,6 @@ function checkParams() {
exit 1
fi

#--db-prepared-snapshot or --db-dump-path
if ([ -z ${DB_PREPARED_SNAPSHOT+x} ] && [ -z ${DB_DUMP_PATH+x} ]); then
>&2 echo "ERROR: Snapshot or dump not given."
exit 1;
fi

if ([ ! -z ${DB_PREPARED_SNAPSHOT+x} ] && [ ! -z ${DB_DUMP_PATH+x} ])
then
>&2 echo "ERROR: Both snapshot and dump sources are given."
Expand All @@ -408,7 +408,7 @@ function checkParams() {
echo "$DB_DUMP_PATH" > $TMP_PATH/db_dump_tmp.sql
DB_DUMP_PATH="$TMP_PATH/db_dump_tmp.sql"
else
[ "$DEBUG" -eq "1" ] && echo "DEBUG: Value given as db-dump-path will use as filename"
[ "$DEBUG" -eq "1" ] && echo "DEBUG: Value given as db-dump will use as filename"
fi
DB_DUMP_FILENAME=$(basename $DB_DUMP_PATH)
DB_DUMP_EXT=${DB_DUMP_FILENAME##*.}
Expand Down Expand Up @@ -1008,9 +1008,9 @@ echo -e "$(date "+%Y-%m-%d %H:%M:%S"): Run done for $DURATION"
echo -e " Report: $ARTIFACTS_DESTINATION/$ARTIFACTS_FILENAME.json"
echo -e " Query log: $ARTIFACTS_DESTINATION/$ARTIFACTS_FILENAME.log.gz"
echo -e " -------------------------------------------"
echo -e " Summary:"
echo -e " Queries duration:\t\t" $(docker_exec cat /$MACHINE_HOME/$ARTIFACTS_FILENAME.json | jq '.overall_stat.queries_duration') " ms"
echo -e " Queries count:\t\t" $( docker_exec cat /$MACHINE_HOME/$ARTIFACTS_FILENAME.json | jq '.overall_stat.queries_number')
echo -e " Normalized queries count:\t" $(docker_exec cat /$MACHINE_HOME/$ARTIFACTS_FILENAME.json | jq '.normalyzed_info| length')
echo -e " Errors count:\t\t\t" $(docker_exec cat /$MACHINE_HOME/$ARTIFACTS_FILENAME.json | jq '.overall_stat.errors_number')
echo -e " Workload summary:"
echo -e " Summarized query duration:\t" $(docker_exec cat /$MACHINE_HOME/$ARTIFACTS_FILENAME.json | jq '.overall_stat.queries_duration') " ms"
echo -e " Queries:\t\t\t" $( docker_exec cat /$MACHINE_HOME/$ARTIFACTS_FILENAME.json | jq '.overall_stat.queries_number')
echo -e " Query groups:\t\t" $(docker_exec cat /$MACHINE_HOME/$ARTIFACTS_FILENAME.json | jq '.normalyzed_info| length')
echo -e " Errors:\t\t\t" $(docker_exec cat /$MACHINE_HOME/$ARTIFACTS_FILENAME.json | jq '.overall_stat.errors_number')
echo -e "-------------------------------------------"
2 changes: 1 addition & 1 deletion tests/nancy_run_before_init_code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
output=$(${BASH_SOURCE%/*}/../nancy run \
--before-db-init-code "select abs from beforeinittable;" \
--workload-custom-sql "file://$srcDir/custom.sql" \
--db-dump-path "file://$srcDir/test.dump.bz2" \
--db-dump "file://$srcDir/test.dump.bz2" \
--tmp-path $srcDir/tmp \
2>&1)

Expand Down
2 changes: 1 addition & 1 deletion tests/nancy_run_ebs_disk_size_warning.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
output=$(${BASH_SOURCE%/*}/../nancy run \
--ebs-volume-size sa \
--workload-custom-sql "file://$srcDir/custom.sql" \
--db-dump-path "file://$srcDir/test.dump.bz2" \
--db-dump "file://$srcDir/test.dump.bz2" \
--tmp-path $srcDir/tmp \
2>&1)

Expand Down
8 changes: 5 additions & 3 deletions tests/nancy_run_localhost_real_workload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ fi
nancyRun="$parentDir/nancy_run.sh"

output=$(
$nancyRun --workload-real "file://$srcDir/sample.replay" \
--db-dump-path "file://$srcDir/test.dump.bz2" \
$nancyRun \
--db-dump "create table hello_world as select i, i as id from generate_series(1, 1000) _(i);" \
--workload-real "file://$srcDir/sample.replay" \
--tmp-path $srcDir/tmp 2>&1
)

if [[ $output =~ "Queries duration:" ]]; then
regex="Queries:[[:blank:]]*1"
if [[ $output =~ $regex ]]; then
echo -e "\e[36mOK\e[39m"
else
>&2 echo -e "\e[31mFAILED\e[39m"
Expand Down
5 changes: 3 additions & 2 deletions tests/nancy_run_localhost_simple_dump.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ nancyRun="$parentDir/nancy_run.sh"

output=$(
$nancyRun --workload-custom-sql "file://$srcDir/custom.sql" \
--db-dump-path "file://$srcDir/test.dump.bz2" \
--db-dump "file://$srcDir/test.dump.bz2" \
--tmp-path $srcDir/tmp 2>&1
)

if [[ $output =~ "Queries duration:" ]]; then
regex="Errors:[[:blank:]]*0"
if [[ $output =~ $regex ]]; then
echo -e "\e[36mOK\e[39m"
else
>&2 echo -e "\e[31mFAILED\e[39m"
Expand Down
5 changes: 3 additions & 2 deletions tests/nancy_run_localhost_simple_dump_with_index.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ nancyRun="$parentDir/nancy_run.sh"
output=$(
$nancyRun --workload-custom-sql "file://$srcDir/custom.sql" \
--tmp-path ${srcDir}/tmp \
--db-dump-path "file://$srcDir/test.dump.bz2" \
--db-dump "file://$srcDir/test.dump.bz2" \
--target-ddl-do "create index i_speedup on t1 using btree(val);" \
--target-ddl-undo "drop index i_speedup;" 2>&1
)

if [[ $output =~ "Queries duration:" ]]; then
regex="Errors:[[:blank:]]*0"
if [[ $output =~ $regex ]]; then
echo -e "\e[36mOK\e[39m"
else
>&2 echo -e "\e[31mFAILED\e[39m"
Expand Down
5 changes: 3 additions & 2 deletions tests/nancy_run_localhost_simple_gz_dump.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ nancyRun="$parentDir/nancy_run.sh"

output=$(
$nancyRun --workload-custom-sql "file://$srcDir/custom.sql" \
--db-dump-path "file://$srcDir/test.dump.gz" \
--db-dump "file://$srcDir/test.dump.gz" \
--tmp-path $srcDir/tmp 2>&1
)

if [[ $output =~ "Queries duration:" ]]; then
regex="Errors:[[:blank:]]*0"
if [[ $output =~ $regex ]]; then
echo -e "\e[36mOK\e[39m"
else
>&2 echo -e "\e[31mFAILED\e[39m"
Expand Down
5 changes: 3 additions & 2 deletions tests/nancy_run_localhost_simple_sql_dump.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ nancyRun="$parentDir/nancy_run.sh"

output=$(
$nancyRun --workload-custom-sql "file://$srcDir/custom.sql" \
--db-dump-path "file://$srcDir/test.dump.sql" \
--db-dump "file://$srcDir/test.dump.sql" \
--tmp-path $srcDir/tmp 2>&1
)

if [[ $output =~ "Queries duration:" ]]; then
regex="Errors:[[:blank:]]*0"
if [[ $output =~ $regex ]]; then
echo -e "\e[36mOK\e[39m"
else
>&2 echo -e "\e[31mFAILED\e[39m"
Expand Down
2 changes: 1 addition & 1 deletion tests/nancy_run_options_both_dump_snapshot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ read -r -d '' params <<PARAMS
--s3cfg-path "/home/someuser/.s3cfg" \
--workload-real "s3://somebucket/db.sql.30min.pgreplay" \
--tmp-path tmp \
--db-dump-path "s3://somebucket/dump.sql.bz2" \
--db-dump "s3://somebucket/dump.sql.bz2" \
--db-prepared-snapshot "s3://somebucket/snapshot"
PARAMS

Expand Down
2 changes: 1 addition & 1 deletion tests/nancy_run_options_ddl_do+_undo-.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ read -r -d '' params <<PARAMS
--s3cfg-path "/home/someuser/.s3cfg" \
--workload-real "s3://somebucket/db.sql.30min.pgreplay" \
--tmp-path tmp \
--db-dump-path "s3://somebucket/dump.sql.bz2" \
--db-dump "s3://somebucket/dump.sql.bz2" \
--target-ddl-do "create\tindex\ti_zzz\ton\tsometable(col1);"
PARAMS

Expand Down
2 changes: 1 addition & 1 deletion tests/nancy_run_options_ddl_do-_undo+.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ read -r -d '' params <<PARAMS
--s3cfg-path "/home/someuser/.s3cfg" \
--workload-real "s3://somebucket/db.sql.30min.pgreplay" \
--tmp-path tmp \
--db-dump-path "s3://somebucket/dump.sql.bz2" \
--db-dump "s3://somebucket/dump.sql.bz2" \
--target-ddl-undo "drop\tindex\ti_zzz;"
PARAMS

Expand Down
2 changes: 1 addition & 1 deletion tests/nancy_run_options_multi_workloads.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ read -r -d '' params <<PARAMS
--workload-real "s3://somebucket/db.sql.30min.pgreplay" \
--workload-custom-sql "select\tnow();" \
--tmp-path tmp \
--db-dump-path "s3://somebucket/dump.sql.bz2"
--db-dump "s3://somebucket/dump.sql.bz2"
PARAMS

output=$(${BASH_SOURCE%/*}/../nancy_run.sh $params 2>&1)
Expand Down
2 changes: 1 addition & 1 deletion tests/nancy_run_options_no_dump_snapshot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ PARAMS

output=$(${BASH_SOURCE%/*}/../nancy_run.sh $params 2>&1)

if [[ $output =~ "ERROR: Snapshot or dump not given." ]]; then
if [[ $output =~ "ERROR: The object (database) is not defined." ]]; then
echo -e "\e[36mOK\e[39m"
else
>&2 echo -e "\e[31mFAILED\e[39m"
Expand Down