mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
issue-7224 Added tests
This commit is contained in:
parent
dffd15f643
commit
2545efcf2e
@ -0,0 +1,4 @@
|
||||
1
|
||||
2
|
||||
1
|
||||
2
|
@ -0,0 +1,66 @@
|
||||
DROP TABLE IF EXISTS current_failed_query_metrics;
|
||||
DROP TABLE IF EXISTS to_insert;
|
||||
|
||||
CREATE TABLE current_failed_query_metrics (event LowCardinality(String), value UInt64) ENGINE = Memory();
|
||||
|
||||
|
||||
INSERT INTO current_failed_query_metrics
|
||||
SELECT event, value
|
||||
FROM system.events
|
||||
WHERE event in ('FailedQuery', 'FailedInsertQuery', 'FailedSelectQuery');
|
||||
|
||||
CREATE TABLE to_insert (value UInt64) ENGINE = Memory();
|
||||
|
||||
-- Failed insert before execution
|
||||
INSERT INTO table_that_do_not_exists VALUES (42); -- { serverError 60 }
|
||||
|
||||
SELECT current_value - previous_value
|
||||
FROM (
|
||||
SELECT event, value as current_value FROM system.events WHERE event like 'FailedInsertQuery'
|
||||
) AS previous
|
||||
ALL JOIN (
|
||||
SELECT event, value as previous_value FROM current_failed_query_metrics
|
||||
) AS current
|
||||
on previous.event = current.event;
|
||||
|
||||
|
||||
-- Failed insert in execution
|
||||
INSERT INTO to_insert SELECT throwIf(1); -- { serverError 395 }
|
||||
|
||||
SELECT current_value - previous_value
|
||||
FROM (
|
||||
SELECT event, value as current_value FROM system.events WHERE event like 'FailedInsertQuery'
|
||||
) AS previous
|
||||
ALL JOIN (
|
||||
SELECT event, value as previous_value FROM current_failed_query_metrics
|
||||
) AS current
|
||||
on previous.event = current.event;
|
||||
|
||||
|
||||
-- Failed select before execution
|
||||
SELECT * FROM table_that_do_not_exists; -- { serverError 60 }
|
||||
|
||||
SELECT current_value - previous_value
|
||||
FROM (
|
||||
SELECT event, value as current_value FROM system.events WHERE event like 'FailedSelectQuery'
|
||||
) AS previous
|
||||
ALL JOIN (
|
||||
SELECT event, value as previous_value FROM current_failed_query_metrics
|
||||
) AS current
|
||||
on previous.event = current.event;
|
||||
|
||||
-- Failed select in execution
|
||||
SELECT throwIf(1); -- { serverError 395 }
|
||||
|
||||
SELECT current_value - previous_value
|
||||
FROM (
|
||||
SELECT event, value as current_value FROM system.events WHERE event like 'FailedSelectQuery'
|
||||
) AS previous
|
||||
ALL JOIN (
|
||||
SELECT event, value as previous_value FROM current_failed_query_metrics
|
||||
) AS current
|
||||
on previous.event = current.event;
|
||||
|
||||
|
||||
DROP TABLE current_failed_query_metrics;
|
||||
DROP TABLE to_insert;
|
Loading…
Reference in New Issue
Block a user