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-03-12 12:51:09 +00:00
|
|
|
# Fetch the repository to find and describe the compared revisions.
|
2020-01-10 14:06:07 +00:00
|
|
|
rm -rf ch ||:
|
2020-03-12 12:51:09 +00:00
|
|
|
time git clone --depth 50 --bare https://github.com/ClickHouse/ClickHouse ch
|
|
|
|
git -C ch fetch origin "$SHA_TO_TEST"
|
|
|
|
|
|
|
|
function find_reference_sha
|
|
|
|
{
|
|
|
|
# If not master, try to fetch pull/.../{head,merge}
|
|
|
|
if [ "$PR_TO_TEST" != "0" ]
|
2020-02-10 18:12:52 +00:00
|
|
|
then
|
2020-03-12 14:17:08 +00:00
|
|
|
git -C ch fetch origin "refs/pull/$PR_TO_TEST/*:refs/heads/pr/*"
|
2020-02-10 18:12:52 +00:00
|
|
|
fi
|
|
|
|
|
2020-03-12 12:51:09 +00:00
|
|
|
# Go back from the revision to be tested, trying to find the closest published
|
|
|
|
# testing release.
|
2020-03-16 14:54:17 +00:00
|
|
|
start_ref="$SHA_TO_TEST"~
|
2020-03-12 12:51:09 +00:00
|
|
|
# If we are testing a PR, and it merges with master successfully, we are
|
|
|
|
# building and testing not the nominal last SHA specified by pull/.../head
|
|
|
|
# and SHA_TO_TEST, but a revision that is merged with recent master, given
|
|
|
|
# by pull/.../merge ref.
|
2020-03-16 14:54:17 +00:00
|
|
|
# Master is the first parent of the pull/.../merge.
|
2020-03-12 14:52:31 +00:00
|
|
|
if git -C ch rev-parse pr/merge
|
2020-03-12 12:51:09 +00:00
|
|
|
then
|
2020-03-16 14:54:17 +00:00
|
|
|
start_ref=pr/merge~
|
2020-03-12 12:51:09 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
while :
|
|
|
|
do
|
2020-03-16 14:54:17 +00:00
|
|
|
# FIXME the original idea was to compare to a closest testing tag, which
|
|
|
|
# is a version that is verified to work correctly. However, we're having
|
|
|
|
# some test stability issues now, and the testing release can't roll out
|
|
|
|
# for more that a weak already because of that. Temporarily switch to
|
|
|
|
# using just closest master, so that we can go on.
|
|
|
|
#ref_tag=$(git -C ch describe --match='v*-testing' --abbrev=0 --first-parent "$start_ref")
|
|
|
|
ref_tag="$start_ref"
|
|
|
|
|
2020-03-12 12:51:09 +00:00
|
|
|
echo Reference tag is "$ref_tag"
|
|
|
|
# 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.
|
|
|
|
REF_SHA=$(git -C ch rev-parse "$ref_tag~0")
|
|
|
|
|
|
|
|
# FIXME sometimes we have testing tags on commits without published builds --
|
|
|
|
# normally these are documentation commits. Loop to skip them.
|
|
|
|
if curl --fail --head "https://clickhouse-builds.s3.yandex.net/0/$REF_SHA/performance/performance.tgz"
|
|
|
|
then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
|
|
|
|
start_ref="$REF_SHA~"
|
|
|
|
done
|
|
|
|
|
|
|
|
REF_PR=0
|
|
|
|
}
|
|
|
|
|
|
|
|
# Find reference revision if not specified explicitly
|
|
|
|
if [ "$REF_SHA" == "" ]; then find_reference_sha; fi
|
|
|
|
if [ "$REF_SHA" == "" ]; then echo Reference SHA is not specified ; exit 1 ; fi
|
|
|
|
if [ "$REF_PR" == "" ]; then echo Reference PR is not specified ; exit 1 ; fi
|
2020-01-27 12:35:56 +00:00
|
|
|
|
|
|
|
# Show what we're testing
|
2020-02-03 17:06:17 +00:00
|
|
|
(
|
2020-03-12 12:51:09 +00:00
|
|
|
git -C ch log -1 --decorate "$REF_SHA" ||:
|
2020-02-03 17:06:17 +00:00
|
|
|
) | tee left-commit.txt
|
2020-03-12 12:51:09 +00:00
|
|
|
|
2020-02-03 17:06:17 +00:00
|
|
|
(
|
2020-03-12 12:51:09 +00:00
|
|
|
git -C ch log -1 --decorate "$SHA_TO_TEST" ||:
|
2020-03-12 14:52:31 +00:00
|
|
|
if git -C ch rev-parse pr/merge &> /dev/null
|
2020-03-12 12:51:09 +00:00
|
|
|
then
|
|
|
|
echo
|
2020-03-12 14:52:31 +00:00
|
|
|
echo Real tested commit is:
|
2020-03-12 12:51:09 +00:00
|
|
|
git -C ch log -1 --decorate pr/merge
|
|
|
|
fi
|
2020-02-03 17:06:17 +00:00
|
|
|
) | tee right-commit.txt
|
2020-01-10 14:06:07 +00:00
|
|
|
|
2020-03-12 12:51:09 +00:00
|
|
|
# Prepare the list of changed tests for use by compare.sh
|
2020-05-22 00:51:42 +00:00
|
|
|
git -C ch diff --name-only "$REF_SHA" "$SHA_TO_TEST" -- 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-04-02 18:44:58 +00:00
|
|
|
# By default, use the main comparison script from the tested package, so that we
|
|
|
|
# can change it in PRs.
|
|
|
|
script_path="right/scripts"
|
|
|
|
if [ -v CHPC_LOCAL_SCRIPT ]
|
|
|
|
then
|
|
|
|
script_path=".."
|
|
|
|
fi
|
|
|
|
|
2020-01-16 19:39:07 +00:00
|
|
|
# Even if we have some errors, try our best to save the logs.
|
|
|
|
set +e
|
2020-03-18 01:28:57 +00:00
|
|
|
|
2020-04-17 15:47:01 +00:00
|
|
|
# Use clickhouse-client and clickhouse-local from the right server.
|
|
|
|
PATH="$(readlink -f right/)":"$PATH"
|
|
|
|
export PATH
|
|
|
|
|
|
|
|
# Start the main comparison script.
|
2020-03-18 01:28:57 +00:00
|
|
|
{ \
|
|
|
|
time ../download.sh "$REF_PR" "$REF_SHA" "$PR_TO_TEST" "$SHA_TO_TEST" && \
|
2020-04-02 18:44:58 +00:00
|
|
|
time stage=configure "$script_path"/compare.sh ; \
|
2020-03-18 01:28:57 +00:00
|
|
|
} 2>&1 | ts "$(printf '%%Y-%%m-%%d %%H:%%M:%%S\t')" | tee compare.log
|
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-05-20 02:19:19 +00:00
|
|
|
7z a /output/output.7z ./*.{log,tsv,html,txt,rep,svg} {right,left}/{performance,db/preprocessed_configs,scripts} report analyze
|
2019-12-26 21:33:10 +00:00
|
|
|
cp compare.log /output
|