Updated test

This commit is contained in:
Alexey Milovidov 2020-02-02 22:49:53 +03:00
parent 38f76b1c6f
commit 5feb40cb6f

View File

@ -45,7 +45,7 @@ SELECT
-- duration, threads_realtime, threads_time_user_system_io,
threads_realtime >= 0.99 * duration,
threads_realtime >= threads_time_user_system_io,
any(length(thread_numbers)) >= 1
any(length(thread_ids)) >= 1
FROM
(SELECT * FROM system.query_log PREWHERE query='$heavy_cpu_query' WHERE event_date >= today()-1 AND type=2 ORDER BY event_time DESC LIMIT 1)
ARRAY JOIN ProfileEvents.Names AS PN, ProfileEvents.Values AS PV"
@ -57,24 +57,24 @@ $CLICKHOUSE_CLIENT $settings --max_threads=3 -q "$heavy_cpu_query"
$CLICKHOUSE_CLIENT $settings -q "SYSTEM FLUSH LOGS"
query_id=`$CLICKHOUSE_CLIENT $settings -q "SELECT query_id FROM system.query_log WHERE event_date >= today()-1 AND type=2 AND query='$heavy_cpu_query' ORDER BY event_time DESC LIMIT 1"`
query_elapsed=`$CLICKHOUSE_CLIENT $settings -q "SELECT query_duration_ms*1000 FROM system.query_log WHERE event_date >= today()-1 AND type=2 AND query_id='$query_id' ORDER BY event_time DESC LIMIT 1"`
threads=`$CLICKHOUSE_CLIENT $settings -q "SELECT length(thread_numbers) FROM system.query_log WHERE event_date >= today()-1 AND type=2 AND query_id='$query_id' ORDER BY event_time DESC LIMIT 1"`
threads=`$CLICKHOUSE_CLIENT $settings -q "SELECT length(thread_ids) FROM system.query_log WHERE event_date >= today()-1 AND type=2 AND query_id='$query_id' ORDER BY event_time DESC LIMIT 1"`
$CLICKHOUSE_CLIENT $settings -q "
SELECT
-- max(thread_realtime), $query_elapsed, max(thread_time_user_system_io),
0.9 * $query_elapsed <= max(thread_realtime) AND max(thread_realtime) <= 1.1 * $query_elapsed,
0.7 * $query_elapsed <= max(thread_time_user_system_io) AND max(thread_time_user_system_io) <= 1.3 * $query_elapsed,
uniqExact(thread_number) = $threads
uniqExact(thread_id) = $threads
FROM
(
SELECT
thread_number,
thread_id,
sumIf(PV, PN = 'RealTimeMicroseconds') AS thread_realtime,
sumIf(PV, PN IN ('UserTimeMicroseconds', 'SystemTimeMicroseconds', 'OSIOWaitMicroseconds', 'OSCPUWaitMicroseconds')) AS thread_time_user_system_io
FROM
(SELECT * FROM system.query_thread_log PREWHERE query_id='$query_id' WHERE event_date >= today()-1)
ARRAY JOIN ProfileEvents.Names AS PN, ProfileEvents.Values AS PV
GROUP BY thread_number
GROUP BY thread_id
)
"