ClickHouse/docker/test/performance-comparison/entrypoint.sh

75 lines
2.5 KiB
Bash
Raw Normal View History

2019-12-26 21:33:10 +00:00
#!/bin/bash
2020-01-10 14:06:07 +00:00
set -ex
2019-12-26 21:33:10 +00:00
2020-01-21 13:42:12 +00:00
chown nobody workspace output
chgrp nogroup workspace output
chmod 777 workspace output
cd workspace
2019-12-26 21:33:10 +00:00
2020-01-10 14:06:07 +00:00
# We will compare to the most recent testing tag in master branch, let's find it.
rm -rf ch ||:
git clone --branch master --single-branch --depth 50 --bare https://github.com/ClickHouse/ClickHouse ch
2020-03-02 18:47:37 +00:00
(cd ch && git fetch origin "$SHA_TO_TEST:to-test")
start_ref=to-test
2020-02-10 18:12:52 +00:00
while :
do
ref_tag=$(cd ch && git describe --match='v*-testing' --abbrev=0 --first-parent $start_ref)
2020-02-27 20:02:50 +00:00
echo Reference tag is "$ref_tag"
2020-02-10 18:12:52 +00:00
# We use annotated tags which have their own shas, so we have to further
# dereference the tag to get the commit it points to, hence the '~0' thing.
2020-02-27 20:02:50 +00:00
ref_sha=$(cd ch && git rev-parse "$ref_tag~0")
2020-02-10 18:12:52 +00:00
2020-03-02 18:47:37 +00:00
# FIXME sometimes we have testing tags on commits without published builds --
# normally these are documentation commits. Loop to skip them.
2020-02-27 20:02:50 +00:00
if curl --fail --head "https://clickhouse-builds.s3.yandex.net/0/$ref_sha/performance/performance.tgz"
2020-02-10 18:12:52 +00:00
then
break
fi
2020-02-27 20:02:50 +00:00
start_ref="$ref_sha~"
2020-02-10 18:12:52 +00:00
done
2020-01-27 12:35:56 +00:00
# Show what we're testing
2020-02-03 17:06:17 +00:00
(
2020-02-27 20:02:50 +00:00
echo Reference SHA is "$ref_sha"
(cd ch && git log -1 --decorate "$ref_sha") ||:
2020-02-03 17:06:17 +00:00
echo
) | tee left-commit.txt
(
2020-02-27 20:02:50 +00:00
echo SHA to test is "$SHA_TO_TEST"
(cd ch && git log -1 --decorate "$SHA_TO_TEST") ||:
2020-02-03 17:06:17 +00:00
echo
) | tee right-commit.txt
2020-01-10 14:06:07 +00:00
2020-02-27 20:02:50 +00:00
(cd ch && git diff --name-only "$SHA_TO_TEST" "$(git merge-base "$SHA_TO_TEST" master)" -- dbms/tests/performance) | tee changed-tests.txt
2020-02-25 19:51:09 +00:00
2020-01-14 19:05:58 +00:00
# Set python output encoding so that we can print queries with Russian letters.
export PYTHONIOENCODING=utf-8
2020-02-14 20:31:57 +00:00
# Use a default number of runs if not told otherwise
2020-02-28 17:08:51 +00:00
export CHPC_RUNS=${CHPC_RUNS:-7}
2020-02-06 12:57:26 +00:00
2020-01-16 19:39:07 +00:00
# Even if we have some errors, try our best to save the logs.
set +e
# compare.sh kills its process group, so put it into a separate one.
# It's probably at fault for using `kill 0` as an error handling mechanism,
# but I can't be bothered to change this now.
set -m
2020-02-27 20:02:50 +00:00
time ../compare.sh 0 "$ref_sha" "$PR_TO_TEST" "$SHA_TO_TEST" 2>&1 | ts "$(printf '%%Y-%%m-%%d %%H:%%M:%%S\t')" | tee compare.log
2020-01-16 19:39:07 +00:00
set +m
2019-12-26 21:33:10 +00:00
2020-02-27 17:57:08 +00:00
# Stop the servers to free memory. Normally they are restarted before getting
# the profile info, so they shouldn't use much, but if the comparison script
# fails in the middle, this might not be the case.
2020-02-27 20:02:50 +00:00
for _ in {1..30}
2020-02-27 17:57:08 +00:00
do
2020-02-27 20:02:50 +00:00
killall clickhouse || break
sleep 1
2020-02-27 17:57:08 +00:00
done
2020-02-25 19:51:09 +00:00
dmesg -T > dmesg.log
2020-02-18 17:30:10 +00:00
2020-03-02 15:05:58 +00:00
7z a /output/output.7z ./*.{log,tsv,html,txt,rep,svg} {right,left}/{performance,db/preprocessed_configs}
2019-12-26 21:33:10 +00:00
cp compare.log /output