From ecbcbad0d96f3d7173d535f9bb181f6104e67ff7 Mon Sep 17 00:00:00 2001 From: alesapin Date: Sat, 12 Sep 2020 10:07:08 +0300 Subject: [PATCH] Fix flaky test --- .../01465_ttl_recompression.reference | 42 +++++++++---------- .../0_stateless/01465_ttl_recompression.sql | 19 +++++---- 2 files changed, 32 insertions(+), 29 deletions(-) diff --git a/tests/queries/0_stateless/01465_ttl_recompression.reference b/tests/queries/0_stateless/01465_ttl_recompression.reference index 524c44ef972..1c576c04e45 100644 --- a/tests/queries/0_stateless/01465_ttl_recompression.reference +++ b/tests/queries/0_stateless/01465_ttl_recompression.reference @@ -1,24 +1,24 @@ CREATE TABLE default.recompression_table\n(\n `dt` DateTime,\n `key` UInt64,\n `value` String\n)\nENGINE = MergeTree()\nPARTITION BY key\nORDER BY tuple()\nTTL dt + toIntervalMonth(1) RECOMPRESS CODEC(ZSTD(17)), dt + toIntervalYear(1) RECOMPRESS CODEC(LZ4HC(10))\nSETTINGS min_rows_for_wide_part = 0, min_bytes_for_wide_part = 0, index_granularity = 8192 3000 -1_1_1_0 LZ4 -2_2_2_0 LZ4 -3_3_3_0 LZ4 -1_1_1_1 LZ4 -2_2_2_1 ZSTD(17) -3_3_3_1 LZ4HC(10) +1_1_1 LZ4 +2_2_2 LZ4 +3_3_3 LZ4 +1_1_1 LZ4 +2_2_2 ZSTD(17) +3_3_3 LZ4HC(10) CREATE TABLE default.recompression_table\n(\n `dt` DateTime,\n `key` UInt64,\n `value` String\n)\nENGINE = MergeTree()\nPARTITION BY key\nORDER BY tuple()\nTTL dt + toIntervalDay(1) RECOMPRESS CODEC(ZSTD(12))\nSETTINGS min_rows_for_wide_part = 0, min_bytes_for_wide_part = 0, index_granularity = 8192 -1_1_1_1_4 LZ4 -2_2_2_1_4 ZSTD(17) -3_3_3_1_4 LZ4HC(10) -1_1_1_2_4 LZ4 -2_2_2_2_4 ZSTD(12) -3_3_3_2_4 ZSTD(12) -1_1_1_2_4 ['plus(dt, toIntervalDay(1))'] -2_2_2_2_4 ['plus(dt, toIntervalDay(1))'] -3_3_3_2_4 ['plus(dt, toIntervalDay(1))'] -1_1_1_0 LZ4 -2_2_2_0 LZ4 -3_3_3_0 LZ4 -1_1_1_0_4 LZ4 -2_2_2_0_4 ZSTD(12) -3_3_3_0_4 ZSTD(12) +1_1_1 LZ4 +2_2_2 ZSTD(17) +3_3_3 LZ4HC(10) +1_1_1 LZ4 +2_2_2 ZSTD(12) +3_3_3 ZSTD(12) +1_1_1 ['plus(dt, toIntervalDay(1))'] +2_2_2 ['plus(dt, toIntervalDay(1))'] +3_3_3 ['plus(dt, toIntervalDay(1))'] +1_1_1 LZ4 +2_2_2 LZ4 +3_3_3 LZ4 +1_1_1 LZ4 +2_2_2 ZSTD(12) +3_3_3 ZSTD(12) diff --git a/tests/queries/0_stateless/01465_ttl_recompression.sql b/tests/queries/0_stateless/01465_ttl_recompression.sql index 78550582307..2388e727722 100644 --- a/tests/queries/0_stateless/01465_ttl_recompression.sql +++ b/tests/queries/0_stateless/01465_ttl_recompression.sql @@ -24,25 +24,27 @@ INSERT INTO recompression_table SELECT now() - INTERVAL 2 YEAR, 3, toString(numb SELECT COUNT() FROM recompression_table; -SELECT name, default_compression_codec FROM system.parts WHERE table = 'recompression_table' and active = 1 and database = currentDatabase() ORDER BY name; +SELECT substring(name, 1, length(name) - 2), default_compression_codec FROM system.parts WHERE table = 'recompression_table' and active = 1 and database = currentDatabase() ORDER BY name; OPTIMIZE TABLE recompression_table FINAL; -SELECT name, default_compression_codec FROM system.parts WHERE table = 'recompression_table' and active = 1 and database = currentDatabase() ORDER BY name; +-- merge level and mutation in part name is not important +SELECT substring(name, 1, length(name) - 2), default_compression_codec FROM system.parts WHERE table = 'recompression_table' and active = 1 and database = currentDatabase() ORDER BY name; ALTER TABLE recompression_table MODIFY TTL dt + INTERVAL 1 DAY RECOMPRESS CODEC(ZSTD(12)) SETTINGS mutations_sync = 2; SHOW CREATE TABLE recompression_table; -SELECT name, default_compression_codec FROM system.parts WHERE table = 'recompression_table' and active = 1 and database = currentDatabase() ORDER BY name; +SELECT substring(name, 1, length(name) - 4), default_compression_codec FROM system.parts WHERE table = 'recompression_table' and active = 1 and database = currentDatabase() ORDER BY name; SYSTEM START TTL MERGES recompression_table; - +-- Additional merge can happen here OPTIMIZE TABLE recompression_table FINAL; -SELECT name, default_compression_codec FROM system.parts WHERE table = 'recompression_table' and active = 1 and database = currentDatabase() ORDER BY name; +-- merge level and mutation in part name is not important +SELECT substring(name, 1, length(name) - 4), default_compression_codec FROM system.parts WHERE table = 'recompression_table' and active = 1 and database = currentDatabase() ORDER BY name; -SELECT name, recompression_ttl_info.expression FROM system.parts WHERE table = 'recompression_table' and active = 1 and database = currentDatabase() ORDER BY name; +SELECT substring(name, 1, length(name) - 4), recompression_ttl_info.expression FROM system.parts WHERE table = 'recompression_table' and active = 1 and database = currentDatabase() ORDER BY name; DROP TABLE IF EXISTS recompression_table; @@ -66,10 +68,11 @@ INSERT INTO recompression_table_compact SELECT now() - INTERVAL 2 MONTH, 2, toSt INSERT INTO recompression_table_compact SELECT now() - INTERVAL 2 YEAR, 3, toString(number) from numbers(2000, 1000); -SELECT name, default_compression_codec FROM system.parts WHERE table = 'recompression_table_compact' and active = 1 and database = currentDatabase() ORDER BY name; +SELECT substring(name, 1, length(name) - 2), default_compression_codec FROM system.parts WHERE table = 'recompression_table_compact' and active = 1 and database = currentDatabase() ORDER BY name; ALTER TABLE recompression_table_compact MODIFY TTL dt + INTERVAL 1 MONTH RECOMPRESS CODEC(ZSTD(12)) SETTINGS mutations_sync = 2; -- mutation affect all columns, so codec changes -SELECT name, default_compression_codec FROM system.parts WHERE table = 'recompression_table_compact' and active = 1 and database = currentDatabase() ORDER BY name; +-- merge level and mutation in part name is not important +SELECT substring(name, 1, length(name) - 4), default_compression_codec FROM system.parts WHERE table = 'recompression_table_compact' and active = 1 and database = currentDatabase() ORDER BY name; DROP TABLE recompression_table_compact;