QueryLog,QueryThreadLOg - better test for query_start_time_microseconds

This commit is contained in:
bharatnc 2020-09-14 19:43:47 -07:00
parent e4e3105014
commit 90e0ef9b70

View File

@ -1,9 +1,36 @@
set log_queries = 1; SET log_queries = 1;
SELECT '01461_query_log_query_start_time_milliseconds_test';
SYSTEM FLUSH LOGS;
-- assumes that the query_start_time field is already accurate.
WITH (
(
SELECT query_start_time_microseconds
FROM system.query_log
ORDER BY query_start_time DESC
LIMIT 1
) AS time_with_microseconds,
(
SELECT query_start_time
FROM system.query_log
ORDER BY query_start_time DESC
LIMIT 1
) AS t)
SELECT if(dateDiff('second', toDateTime(time_with_microseconds), toDateTime(t)) = 0, 'ok', 'fail'); --
select '01461_query_log_query_start_time_milliseconds_test'; SELECT '01461_query_thread_log_query_start_time_milliseconds_test';
system flush logs; SYSTEM FLUSH LOGS;
SELECT If((select count(query_start_time_microseconds) from system.query_log WHERE query LIKE '%01461_query_log_query_start_time_milliseconds_test%' AND query NOT LIKE '%system.query_log%') > 0, 'ok', 'fail'); -- assumes that the query_start_time field is already accurate.
WITH (
select '01461_query_thread_log_query_start_time_milliseconds_test'; (
system flush logs; SELECT query_start_time_microseconds
SELECT If((select count(query_start_time_microseconds) from system.query_log WHERE query LIKE '%01461_query_thread_log_query_start_time_milliseconds_test%' AND query NOT LIKE '%system.query_log%') > 0, 'ok', 'fail'); FROM system.query_thread_log
ORDER BY query_start_time DESC
LIMIT 1
) AS time_with_microseconds,
(
SELECT query_start_time
FROM system.query_thread_log
ORDER BY query_start_time DESC
LIMIT 1
) AS t)
SELECT if(dateDiff('second', toDateTime(time_with_microseconds), toDateTime(t)) = 0, 'ok', 'fail'); --