From 065faf13185e54bdd1515312f0588e71e25ad5e0 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov Date: Thu, 18 Mar 2021 01:32:39 +0300 Subject: [PATCH 1/2] more robust error handling in perf test --- docker/test/performance-comparison/compare.sh | 2 +- docker/test/performance-comparison/perf.py | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/docker/test/performance-comparison/compare.sh b/docker/test/performance-comparison/compare.sh index 4d862cf987e..787cb5a3799 100755 --- a/docker/test/performance-comparison/compare.sh +++ b/docker/test/performance-comparison/compare.sh @@ -779,7 +779,7 @@ create view test_times_view_total as sum(total_client_time), sum(queries), max(query_max), - sum(real) / sum(queries) avg_real_per_query, + sum(real) / if(sum(queries), sum(queries), 1) avg_real_per_query, min(query_min), -- Totaling the number of runs doesn't make sense, but use the max so -- that the reporting script doesn't complain about queries being too diff --git a/docker/test/performance-comparison/perf.py b/docker/test/performance-comparison/perf.py index f1c5df146aa..3ddaf99b879 100755 --- a/docker/test/performance-comparison/perf.py +++ b/docker/test/performance-comparison/perf.py @@ -263,8 +263,17 @@ for query_index in queries_to_run: for conn_index, c in enumerate(all_connections): try: prewarm_id = f'{query_prefix}.prewarm0' - # Will also detect too long queries during warmup stage - res = c.execute(q, query_id = prewarm_id, settings = {'max_execution_time': 10}) + + try: + # Will also detect too long queries during warmup stage + res = c.execute(q, query_id = prewarm_id, settings = {'max_execution_time': 10}) + except clickhouse_driver.errors.Error as e: + # Add query id to the exception to make debugging easier. + e.args = (prewarm_id, *e.args) + e.message = prewarm_id + ': ' + e.message + raise + + print(f'prewarm\t{query_index}\t{prewarm_id}\t{conn_index}\t{c.last_query.elapsed}') except KeyboardInterrupt: raise @@ -312,7 +321,7 @@ for query_index in queries_to_run: for conn_index, c in enumerate(this_query_connections): try: res = c.execute(q, query_id = run_id) - except Exception as e: + except clickhouse_driver.errors.Error as e: # Add query id to the exception to make debugging easier. e.args = (run_id, *e.args) e.message = run_id + ': ' + e.message @@ -389,7 +398,7 @@ for query_index in queries_to_run: try: res = c.execute(q, query_id = run_id, settings = {'query_profiler_real_time_period_ns': 10000000}) print(f'profile\t{query_index}\t{run_id}\t{conn_index}\t{c.last_query.elapsed}') - except Exception as e: + except clickhouse_driver.errors.Error as e: # Add query id to the exception to make debugging easier. e.args = (run_id, *e.args) e.message = run_id + ': ' + e.message From f2ac17cfba1d3bfcc82faf0c5f9816ac04e933cd Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 18 Mar 2021 17:59:49 +0300 Subject: [PATCH 2/2] Update compare.sh --- docker/test/performance-comparison/compare.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/test/performance-comparison/compare.sh b/docker/test/performance-comparison/compare.sh index 787cb5a3799..d46e2c97742 100755 --- a/docker/test/performance-comparison/compare.sh +++ b/docker/test/performance-comparison/compare.sh @@ -758,7 +758,7 @@ create view test_times_view as total_client_time, queries, query_max, - real / queries avg_real_per_query, + real / if(queries > 0, queries, 1) avg_real_per_query, query_min, runs from test_time @@ -779,7 +779,7 @@ create view test_times_view_total as sum(total_client_time), sum(queries), max(query_max), - sum(real) / if(sum(queries), sum(queries), 1) avg_real_per_query, + sum(real) / if(sum(queries) > 0, sum(queries), 1) avg_real_per_query, min(query_min), -- Totaling the number of runs doesn't make sense, but use the max so -- that the reporting script doesn't complain about queries being too