2024-05-08 14:17:36 +00:00
|
|
|
-- Tags: no-tsan, no-asan, no-ubsan, no-msan, no-debug
|
2021-09-12 12:35:27 +00:00
|
|
|
|
2020-09-06 02:49:47 +00:00
|
|
|
-- This file contains tests for the event_time_microseconds field for various tables.
|
|
|
|
-- Note: Only event_time_microseconds for asynchronous_metric_log table is tested via
|
|
|
|
-- an integration test as those metrics take 60s by default to be updated.
|
|
|
|
-- Refer: tests/integration/test_asynchronous_metric_log_table.
|
2020-09-05 23:17:28 +00:00
|
|
|
|
2020-09-11 17:10:44 +00:00
|
|
|
SET log_queries = 1;
|
2022-05-11 01:09:53 +00:00
|
|
|
SET log_query_threads = 1;
|
2020-09-27 13:25:28 +00:00
|
|
|
SET query_profiler_real_time_period_ns = 100000000;
|
|
|
|
-- a long enough query to trigger the query profiler and to record trace log
|
|
|
|
SELECT sleep(2) FORMAT Null;
|
|
|
|
SET query_profiler_real_time_period_ns = 1000000000;
|
|
|
|
SYSTEM FLUSH LOGS;
|
2020-09-05 23:21:51 +00:00
|
|
|
|
2020-09-11 17:10:44 +00:00
|
|
|
SELECT '01473_metric_log_table_event_start_time_microseconds_test';
|
2020-09-10 07:17:20 +00:00
|
|
|
-- query assumes that the event_time field is accurate.
|
|
|
|
WITH (
|
2020-09-27 13:25:28 +00:00
|
|
|
SELECT event_time_microseconds, event_time
|
2020-09-10 07:17:20 +00:00
|
|
|
FROM system.metric_log
|
|
|
|
ORDER BY event_time DESC
|
|
|
|
LIMIT 1
|
2020-09-27 13:25:28 +00:00
|
|
|
) AS time
|
|
|
|
SELECT if(dateDiff('second', toDateTime(time.1), toDateTime(time.2)) = 0, 'ok', toString(time));
|
2020-09-10 06:52:47 +00:00
|
|
|
|
2020-09-15 01:57:31 +00:00
|
|
|
SELECT '01473_trace_log_table_event_start_time_microseconds_test';
|
|
|
|
WITH (
|
2020-09-27 13:25:28 +00:00
|
|
|
SELECT event_time_microseconds, event_time
|
2020-09-15 01:57:31 +00:00
|
|
|
FROM system.trace_log
|
|
|
|
ORDER BY event_time DESC
|
|
|
|
LIMIT 1
|
2020-09-27 13:25:28 +00:00
|
|
|
) AS time
|
|
|
|
SELECT if(dateDiff('second', toDateTime(time.1), toDateTime(time.2)) = 0, 'ok', toString(time));
|
2020-09-15 01:57:31 +00:00
|
|
|
|
2020-09-11 17:10:44 +00:00
|
|
|
SELECT '01473_query_log_table_event_start_time_microseconds_test';
|
|
|
|
WITH (
|
2020-09-27 13:25:28 +00:00
|
|
|
SELECT event_time_microseconds, event_time
|
2020-09-11 17:10:44 +00:00
|
|
|
FROM system.query_log
|
2021-01-26 19:56:11 +00:00
|
|
|
WHERE current_database = currentDatabase()
|
2020-09-11 17:10:44 +00:00
|
|
|
ORDER BY event_time DESC
|
|
|
|
LIMIT 1
|
2020-09-27 13:25:28 +00:00
|
|
|
) AS time
|
|
|
|
SELECT if(dateDiff('second', toDateTime(time.1), toDateTime(time.2)) = 0, 'ok', toString(time));
|
2020-09-11 17:10:44 +00:00
|
|
|
|
|
|
|
SELECT '01473_query_thread_log_table_event_start_time_microseconds_test';
|
|
|
|
WITH (
|
2020-09-27 13:25:28 +00:00
|
|
|
SELECT event_time_microseconds, event_time
|
2020-09-11 17:10:44 +00:00
|
|
|
FROM system.query_thread_log
|
2021-01-26 19:56:11 +00:00
|
|
|
WHERE current_database = currentDatabase()
|
2020-09-11 17:10:44 +00:00
|
|
|
ORDER BY event_time DESC
|
|
|
|
LIMIT 1
|
2020-09-27 13:25:28 +00:00
|
|
|
) AS time
|
|
|
|
SELECT if(dateDiff('second', toDateTime(time.1), toDateTime(time.2)) = 0, 'ok', toString(time));
|
|
|
|
|
|
|
|
SELECT '01473_text_log_table_event_start_time_microseconds_test';
|
|
|
|
WITH (
|
|
|
|
SELECT event_time_microseconds, event_time
|
|
|
|
FROM system.query_thread_log
|
2021-01-26 19:56:11 +00:00
|
|
|
WHERE current_database = currentDatabase()
|
2020-09-27 13:25:28 +00:00
|
|
|
ORDER BY event_time DESC
|
|
|
|
LIMIT 1
|
|
|
|
) AS time
|
|
|
|
SELECT if(dateDiff('second', toDateTime(time.1), toDateTime(time.2)) = 0, 'ok', toString(time));
|