From 61f16555b20dc3a2a28825a6c5e7ff280d77b2bd Mon Sep 17 00:00:00 2001 From: Onur Tirtir Date: Tue, 31 Oct 2023 18:20:53 +0300 Subject: [PATCH] fix flakyness --- .../regress/expected/multi_size_queries.out | 62 +++++++++++-------- src/test/regress/sql/multi_size_queries.sql | 27 +++++--- 2 files changed, 53 insertions(+), 36 deletions(-) diff --git a/src/test/regress/expected/multi_size_queries.out b/src/test/regress/expected/multi_size_queries.out index 24178903f..b4ec7fb43 100644 --- a/src/test/regress/expected/multi_size_queries.out +++ b/src/test/regress/expected/multi_size_queries.out @@ -37,60 +37,68 @@ SELECT replicate_table_shards('lineitem_hash_part', shard_replication_factor:=2, -- Tests on distributed table with replication factor > 1 VACUUM (FULL) lineitem_hash_part; -SELECT citus_table_size('lineitem_hash_part'); - citus_table_size +-- citus_table_size, citus_relation_size and citus_total_relation_size should return the same value +-- and that value should be greater than 0 +SELECT citus_table_size('lineitem_hash_part') = citus_relation_size('lineitem_hash_part'); + ?column? --------------------------------------------------------------------- - 3801088 + t (1 row) -SELECT citus_relation_size('lineitem_hash_part'); - citus_relation_size +SELECT citus_relation_size('lineitem_hash_part') = citus_total_relation_size('lineitem_hash_part'); + ?column? --------------------------------------------------------------------- - 3801088 + t (1 row) -SELECT citus_total_relation_size('lineitem_hash_part'); - citus_total_relation_size +SELECT citus_table_size('lineitem_hash_part') > 0; + ?column? --------------------------------------------------------------------- - 3801088 + t (1 row) CREATE INDEX lineitem_hash_part_idx ON lineitem_hash_part(l_orderkey); VACUUM (FULL) lineitem_hash_part; -SELECT citus_table_size('lineitem_hash_part'); - citus_table_size +-- citus_table_size and citus_relation_size should return the same value +-- and that value should be greater than 0 +SELECT citus_table_size('lineitem_hash_part') = citus_relation_size('lineitem_hash_part'); + ?column? --------------------------------------------------------------------- - 3801088 + t (1 row) -SELECT citus_relation_size('lineitem_hash_part'); - citus_relation_size +SELECT citus_table_size('lineitem_hash_part') > 0; + ?column? --------------------------------------------------------------------- - 3801088 + t (1 row) -SELECT citus_total_relation_size('lineitem_hash_part'); - citus_total_relation_size +-- citus_table_size, citus_relation_size and citus_total_relation_size should return the same value +-- and that value should be greater than 0 +SELECT citus_table_size('lineitem_hash_part_idx') = citus_relation_size('lineitem_hash_part_idx'); + ?column? --------------------------------------------------------------------- - 4259840 + t (1 row) -SELECT citus_table_size('lineitem_hash_part_idx'); - citus_table_size +SELECT citus_table_size('lineitem_hash_part_idx') = citus_total_relation_size('lineitem_hash_part_idx'); + ?column? --------------------------------------------------------------------- - 458752 + t (1 row) -SELECT citus_relation_size('lineitem_hash_part_idx'); - citus_relation_size +SELECT citus_table_size('lineitem_hash_part_idx') > 0; + ?column? --------------------------------------------------------------------- - 458752 + t (1 row) -SELECT citus_total_relation_size('lineitem_hash_part_idx'); - citus_total_relation_size +-- citus_total_relation_size should return the sum of table & index size +SELECT citus_total_relation_size('lineitem_hash_part') = + citus_table_size('lineitem_hash_part') + citus_table_size('lineitem_hash_part_idx'); + ?column? --------------------------------------------------------------------- - 458752 + t (1 row) DROP INDEX lineitem_hash_part_idx; diff --git a/src/test/regress/sql/multi_size_queries.sql b/src/test/regress/sql/multi_size_queries.sql index 1869b0517..b431e751d 100644 --- a/src/test/regress/sql/multi_size_queries.sql +++ b/src/test/regress/sql/multi_size_queries.sql @@ -31,20 +31,29 @@ SELECT replicate_table_shards('lineitem_hash_part', shard_replication_factor:=2, -- Tests on distributed table with replication factor > 1 VACUUM (FULL) lineitem_hash_part; -SELECT citus_table_size('lineitem_hash_part'); -SELECT citus_relation_size('lineitem_hash_part'); -SELECT citus_total_relation_size('lineitem_hash_part'); +-- citus_table_size, citus_relation_size and citus_total_relation_size should return the same value +-- and that value should be greater than 0 +SELECT citus_table_size('lineitem_hash_part') = citus_relation_size('lineitem_hash_part'); +SELECT citus_relation_size('lineitem_hash_part') = citus_total_relation_size('lineitem_hash_part'); +SELECT citus_table_size('lineitem_hash_part') > 0; CREATE INDEX lineitem_hash_part_idx ON lineitem_hash_part(l_orderkey); VACUUM (FULL) lineitem_hash_part; -SELECT citus_table_size('lineitem_hash_part'); -SELECT citus_relation_size('lineitem_hash_part'); -SELECT citus_total_relation_size('lineitem_hash_part'); +-- citus_table_size and citus_relation_size should return the same value +-- and that value should be greater than 0 +SELECT citus_table_size('lineitem_hash_part') = citus_relation_size('lineitem_hash_part'); +SELECT citus_table_size('lineitem_hash_part') > 0; -SELECT citus_table_size('lineitem_hash_part_idx'); -SELECT citus_relation_size('lineitem_hash_part_idx'); -SELECT citus_total_relation_size('lineitem_hash_part_idx'); +-- citus_table_size, citus_relation_size and citus_total_relation_size should return the same value +-- and that value should be greater than 0 +SELECT citus_table_size('lineitem_hash_part_idx') = citus_relation_size('lineitem_hash_part_idx'); +SELECT citus_table_size('lineitem_hash_part_idx') = citus_total_relation_size('lineitem_hash_part_idx'); +SELECT citus_table_size('lineitem_hash_part_idx') > 0; + +-- citus_total_relation_size should return the sum of table & index size +SELECT citus_total_relation_size('lineitem_hash_part') = + citus_table_size('lineitem_hash_part') + citus_table_size('lineitem_hash_part_idx'); DROP INDEX lineitem_hash_part_idx;