Do not continue perf tests in case of exception in create_query/fill_query

Previously due to using of threading.Thread, exception had been
ignored, and perf test simply continues, yes it will show some errors,
but it also may show that the test became faster, while it is because
the underlying table was empty.

Replace threading.Thread with a SafeThread (inline implementation) that
simply rethrow exception in join.

Here is an example of such report [1], look at the ip_trie test.

  [1]: https://s3.amazonaws.com/clickhouse-test-reports/45654/2101b66570cbb9eb9a492afa8ab82d562c34336b/performance_comparison_[3/4]/report.html

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
Azat Khuzhin 2023-02-13 17:30:57 +01:00
parent 95db6fb1a6
commit dc5d7809b6

View File

@ -26,6 +26,22 @@ logging.basicConfig(
total_start_seconds = time.perf_counter() total_start_seconds = time.perf_counter()
stage_start_seconds = total_start_seconds stage_start_seconds = total_start_seconds
# Thread executor that does not hides exception that happens during function
# execution, and rethrows it after join()
class SafeThread(Thread):
run_exception = None
def run(self):
try:
super().run()
except:
self.run_exception = sys.exc_info()
def join(self):
super().join()
if self.run_exception:
raise self.run_exception[1]
def reportStageEnd(stage): def reportStageEnd(stage):
global stage_start_seconds, total_start_seconds global stage_start_seconds, total_start_seconds
@ -283,7 +299,7 @@ if not args.use_existing_tables:
print(f"create\t{index}\t{connection.last_query.elapsed}\t{tsv_escape(q)}") print(f"create\t{index}\t{connection.last_query.elapsed}\t{tsv_escape(q)}")
threads = [ threads = [
Thread(target=do_create, args=(connection, index, create_queries)) SafeThread(target=do_create, args=(connection, index, create_queries))
for index, connection in enumerate(all_connections) for index, connection in enumerate(all_connections)
] ]