Choose proper old version for perf comparison

This commit is contained in:
Alexander Kuzmenkov 2020-07-23 18:16:40 +03:00
parent 186b2c3b1b
commit acf1e5fe7e
2 changed files with 38 additions and 45 deletions

View File

@ -6,7 +6,6 @@ trap 'kill $(jobs -pr) ||:' EXIT
mkdir db0 ||:
mkdir left ||:
mkdir right ||:
left_pr=$1
left_sha=$2
@ -24,7 +23,7 @@ dataset_paths["values"]="https://clickhouse-datasets.s3.yandex.net/values_with_e
function download
{
# Historically there were various path for the performance test package.
# Historically there were various paths for the performance test package.
# Test all of them.
for path in "https://clickhouse-builds.s3.yandex.net/$left_pr/$left_sha/"{,clickhouse_build_check/}"performance/performance.tgz"
do
@ -34,22 +33,13 @@ function download
fi
done
for path in "https://clickhouse-builds.s3.yandex.net/$right_pr/$right_sha/"{,clickhouse_build_check/}"performance/performance.tgz"
do
if curl --fail --head "$path"
then
right_path="$path"
fi
done
# might have the same version on left and right
if ! [ "$left_path" = "$right_path" ]
# Might have the same version on left and right (for testing).
if ! [ "$left_sha" = "$right_sha" ]
then
wget -nv -nd -c "$left_path" -O- | tar -C left --strip-components=1 -zxv &
wget -nv -nd -c "$right_path" -O- | tar -C right --strip-components=1 -zxv &
else
mkdir right ||:
wget -nv -nd -c "$left_path" -O- | tar -C left --strip-components=1 -zxv && cp -a left/* right &
mkdir left ||:
cp -a right/* left &
fi
for dataset_name in $datasets

View File

@ -1,38 +1,23 @@
#!/bin/bash
set -ex
chown nobody workspace output
chgrp nogroup workspace output
chmod 777 workspace output
cd workspace
# Fetch the repository to find and describe the compared revisions.
rm -rf ch ||:
time git clone --depth 50 --bare https://github.com/ClickHouse/ClickHouse ch
git -C ch fetch origin "$SHA_TO_TEST"
# Use the packaged repository to find the revision we will compare to.
function find_reference_sha
{
# If not master, try to fetch pull/.../{head,merge}
if [ "$PR_TO_TEST" != "0" ]
then
git -C ch fetch origin "refs/pull/$PR_TO_TEST/*:refs/heads/pull/$PR_TO_TEST/*"
fi
# Go back from the revision to be tested, trying to find the closest published
# testing release.
start_ref="$SHA_TO_TEST"~
# 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.
# Master is the first parent of the pull/.../merge.
if git -C ch rev-parse "pull/$PR_TO_TEST/merge"
# testing release. The PR branch may be either pull/*/head which is the
# author's branch, or pull/*/merge, which is head merged with some master
# automatically by Github. We will use a merge base with master as a reference
# for tesing (or some older commit). A caveat is that if we're testing the
# master, the merge base is the tested commit itself, so we have to step back
# once.
start_ref=$(git -C ch merge-base origin/master pr)
if [ "PR_TO_TEST" == "0" ]
then
start_ref="pull/$PR_TO_TEST/merge~"
start_ref=$start_ref~
fi
# Loop back to find a commit that actually has a published perf test package.
while :
do
# FIXME the original idea was to compare to a closest testing tag, which
@ -48,10 +33,10 @@ function find_reference_sha
# 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.
# Historically there were various path for the performance test package.
# Test all of them.
# FIXME sometimes we have testing tags on commits without published builds.
# Normally these are documentation commits. Loop to skip them.
# Historically there were various path for the performance test package,
# test all of them.
unset found
for path in "https://clickhouse-builds.s3.yandex.net/0/$REF_SHA/"{,clickhouse_build_check/}"performance/performance.tgz"
do
@ -69,6 +54,24 @@ function find_reference_sha
REF_PR=0
}
chown nobody workspace output
chgrp nogroup workspace output
chmod 777 workspace output
cd workspace
# Download the package for the version we are going to test
for path in "https://clickhouse-builds.s3.yandex.net/$PR_TO_TEST/$SHA_TO_TEST/"{,clickhouse_build_check/}"performance/performance.tgz"
do
if curl --fail --head "$path"
then
right_path="$path"
fi
done
mkdir right
wget -nv -nd -c "$right_path" -O- | tar -C right --strip-components=1 -zxv
# 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