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

Commit c9d35d9

Browse files
dmiusDmitry
authored andcommitted
Some bugs fixed + save json log fixed
1 parent 926c079 commit c9d35d9

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

nancy_run.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ sleep 1 # wait for postgres up&running
444444
DB_DUMP_FILENAME=$(basename $DB_DUMP_PATH)
445445
docker_exec bash -c "bzcat /machine_home/$DB_DUMP_FILENAME | psql --set ON_ERROR_STOP=on -U postgres test"
446446
# After init database sql code apply
447-
echo "Apply sql code after db init from $AFTER_DB_INIT_CODE"
447+
echo "Apply sql code after db init"
448448
if ([ -v AFTER_DB_INIT_CODE ] && [ "$AFTER_DB_INIT_CODE" != "" ])
449449
then
450450
AFTER_DB_INIT_CODE_FILENAME=$(basename $AFTER_DB_INIT_CODE)
@@ -462,7 +462,7 @@ if ([ -v TARGET_DDL_DO ] && [ "$TARGET_DDL_DO" != "" ]); then
462462
docker_exec bash -c "psql -U postgres test -E -f /machine_home/$TARGET_DDL_DO_FILENAME"
463463
fi
464464
# Apply postgres configuration
465-
echo "Apply postgres conf from $TARGET_CONFIG"
465+
echo "Apply postgres conf"
466466
if ([ -v TARGET_CONFIG ] && [ "$TARGET_CONFIG" != "" ]); then
467467
TARGET_CONFIG_FILENAME=$(basename $TARGET_CONFIG)
468468
docker_exec bash -c "cat /machine_home/$TARGET_CONFIG_FILENAME >> /etc/postgresql/$PG_VERSION/main/postgresql.conf"
@@ -478,7 +478,7 @@ if [ -v WORKLOAD_FULL_PATH ] && [ "$WORKLOAD_FULL_PATH" != '' ];then
478478
echo "Execute pgreplay queries..."
479479
docker_exec psql -U postgres test -c 'create role testuser superuser login;'
480480
WORKLOAD_FILE_NAME=$(basename $WORKLOAD_FULL_PATH)
481-
docker_exec bash -c "pgreplay -r -j ./$WORKLOAD_FILE_NAME"
481+
docker_exec bash -c "pgreplay -r -j /machine_home/$WORKLOAD_FILE_NAME"
482482
else
483483
if ([ -v WORKLOAD_CUSTOM_SQL ] && [ "$WORKLOAD_CUSTOM_SQL" != "" ]); then
484484
WORKLOAD_CUSTOM_FILENAME=$(basename $WORKLOAD_CUSTOM_SQL)
@@ -490,22 +490,22 @@ fi
490490
## Get statistics
491491
echo "Prepare JSON log..."
492492
docker_exec bash -c "/root/pgbadger/pgbadger -j $(cat /proc/cpuinfo | grep processor | wc -l) --prefix '%t [%p]: [%l-1] db=%d,user=%u (%a,%h)' /var/log/postgresql/* -f stderr -o /machine_home/$ARTIFACTS_FILENAME.json"
493-
echo "Upload JSON log..."
494493

494+
echo "Save JSON log..."
495495
if [[ $ARTIFACTS_DESTINATION =~ "s3://" ]]; then
496496
docker_exec s3cmd put /machine_home/$ARTIFACTS_FILENAME.json $ARTIFACTS_DESTINATION/
497497
else
498498
if [ "$RUN_ON" = "localhost" ]; then
499499
cp "$TMP_PATH/pg_nancy_home_${CURRENT_TS}/"$ARTIFACTS_FILENAME.json $ARTIFACTS_DESTINATION/
500500
elif [ "$RUN_ON" = "aws" ]; then
501-
docker-machine scp /machine_home/$ARTIFACTS_FILENAME.json $DOCKER_MACHINE:/home/ubuntu
501+
docker-machine scp $DOCKER_MACHINE:/home/ubuntu/$ARTIFACTS_FILENAME.json $ARTIFACTS_DESTINATION/
502502
else
503503
>&2 echo "ASSERT: must not reach this point"
504504
exit 1
505505
fi
506506
fi
507507

508-
echo "Apply DDL undo SQL code from /machine_home/ddl_undo_$DOCKER_MACHINE.sql"
508+
echo "Apply DDL undo SQL code"
509509
if ([ -v TARGET_DDL_UNDO ] && [ "$TARGET_DDL_UNDO" != "" ]); then
510510
TARGET_DDL_UNDO_FILENAME=$(basename $TARGET_DDL_UNDO)
511511
docker_exec bash -c "psql -U postgres test -E -f /machine_home/$TARGET_DDL_UNDO_FILENAME"

0 commit comments

Comments
 (0)