ClickHouse/tests/queries/0_stateless/02378_part_log_profile_events.sql

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

51 lines
2.2 KiB
MySQL
Raw Normal View History

2022-08-06 18:53:17 +00:00
DROP TABLE IF EXISTS test;
2023-01-23 12:45:28 +00:00
CREATE TABLE test (key UInt64, val UInt64) engine = MergeTree Order by key PARTITION BY key >= 128;
SET max_block_size = 64, max_insert_block_size = 64, min_insert_block_size_rows = 64;
INSERT INTO test SELECT number AS key, sipHash64(number) AS val FROM numbers(512);
SYSTEM FLUSH LOGS;
2023-01-24 11:23:17 +00:00
2023-01-23 12:45:28 +00:00
SELECT
2023-01-24 11:23:17 +00:00
if(count(DISTINCT query_id) == 1, 'Ok', 'Error: ' || toString(count(DISTINCT query_id))),
if(count() == 512 / 64, 'Ok', 'Error: ' || toString(count())), -- 512 rows inserted, 64 rows per block
if(SUM(ProfileEvents['MergeTreeDataWriterRows']) == 512, 'Ok', 'Error: ' || toString(SUM(ProfileEvents['MergeTreeDataWriterRows']))),
if(SUM(ProfileEvents['MergeTreeDataWriterUncompressedBytes']) >= 1024, 'Ok', 'Error: ' || toString(SUM(ProfileEvents['MergeTreeDataWriterUncompressedBytes']))),
if(SUM(ProfileEvents['MergeTreeDataWriterCompressedBytes']) >= 1024, 'Ok', 'Error: ' || toString(SUM(ProfileEvents['MergeTreeDataWriterCompressedBytes']))),
if(SUM(ProfileEvents['MergeTreeDataWriterBlocks']) >= 8, 'Ok', 'Error: ' || toString(SUM(ProfileEvents['MergeTreeDataWriterBlocks'])))
2023-01-23 12:45:28 +00:00
FROM system.part_log
WHERE event_time > now() - INTERVAL 10 MINUTE
AND database == currentDatabase() AND table == 'test'
AND event_type == 'NewPart'
;
2022-08-06 18:53:17 +00:00
OPTIMIZE TABLE test FINAL;
SYSTEM FLUSH LOGS;
2023-01-23 12:45:28 +00:00
SELECT
2023-01-24 11:23:17 +00:00
if(count() > 2, 'Ok', 'Error: ' || toString(count())),
if(SUM(ProfileEvents['MergedRows']) >= 512, 'Ok', 'Error: ' || toString(SUM(ProfileEvents['MergedRows'])))
2023-01-23 12:45:28 +00:00
FROM system.part_log
WHERE event_time > now() - INTERVAL 10 MINUTE
AND database == currentDatabase() AND table == 'test'
AND event_type == 'MergeParts'
;
ALTER TABLE test UPDATE val = 0 WHERE key % 2 == 0 SETTINGS mutations_sync = 2;
2022-08-06 18:53:17 +00:00
2023-01-23 12:45:28 +00:00
SYSTEM FLUSH LOGS;
2023-01-24 11:23:17 +00:00
2023-01-23 12:45:28 +00:00
SELECT
2023-01-24 11:23:17 +00:00
if(count() == 2, 'Ok', 'Error: ' || toString(count())),
2023-02-08 11:16:16 +00:00
if(SUM(ProfileEvents['MergedRows']) == 512, 'Ok', 'Error: ' || toString(SUM(ProfileEvents['MergedRows']))),
2023-01-24 11:23:17 +00:00
if(SUM(ProfileEvents['FileOpen']) > 1, 'Ok', 'Error: ' || toString(SUM(ProfileEvents['FileOpen'])))
2023-01-23 12:45:28 +00:00
FROM system.part_log
WHERE event_time > now() - INTERVAL 10 MINUTE
AND database == currentDatabase() AND table == 'test'
AND event_type == 'MutatePart'
;
2022-08-06 18:53:17 +00:00
DROP TABLE test;