diff --git a/src/test/regress/citus_tests/run_test.py b/src/test/regress/citus_tests/run_test.py index 6ae17060f..b902a7998 100755 --- a/src/test/regress/citus_tests/run_test.py +++ b/src/test/regress/citus_tests/run_test.py @@ -207,6 +207,10 @@ DEPS = { "multi_cluster_management", ], ), + "multi_utilities": TestDeps( + "minimal_schedule", + ["multi_data_types"], + ), } diff --git a/src/test/regress/expected/multi_utilities.out b/src/test/regress/expected/multi_utilities.out index b82e54f16..cfaba201f 100644 --- a/src/test/regress/expected/multi_utilities.out +++ b/src/test/regress/expected/multi_utilities.out @@ -347,12 +347,24 @@ DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx -- should not propagate because no distributed table is specified insert into local_vacuum_table select i from generate_series(1,1000000) i; delete from local_vacuum_table; +-- sometimes the vacuum doesn't clean up as expected and results in a flaky result +-- for our tests. For this reason, we re-run the vacuum command once if size of +-- the table before and after the VACUUM is not as expected +SELECT pg_total_relation_size('local_vacuum_table') AS size_before_vacuum \gset VACUUM local_vacuum_table; -SELECT CASE WHEN s BETWEEN 20000000 AND 25000000 THEN 22500000 ELSE s END -FROM pg_total_relation_size('local_vacuum_table') s ; - s +SELECT pg_total_relation_size('local_vacuum_table') AS size_after_vacuum \gset +SELECT :size_before_vacuum <= :size_after_vacuum AS re_vacuum_needed \gset +\if :re_vacuum_needed +SELECT pg_total_relation_size('local_vacuum_table') AS size_before_vacuum \gset +VACUUM local_vacuum_table; +VACUUM local_vacuum_table; +VACUUM local_vacuum_table; +SELECT pg_total_relation_size('local_vacuum_table') AS size_after_vacuum \gset +\endif +SELECT :size_before_vacuum > :size_after_vacuum AS vacuum_successful; + vacuum_successful --------------------------------------------------------------------- - 22500000 + t (1 row) -- vacuum full deallocates pages of dead tuples whereas normal vacuum only marks dead tuples on visibility map diff --git a/src/test/regress/sql/multi_utilities.sql b/src/test/regress/sql/multi_utilities.sql index 9a14ab590..6b66b19dc 100644 --- a/src/test/regress/sql/multi_utilities.sql +++ b/src/test/regress/sql/multi_utilities.sql @@ -228,9 +228,24 @@ VACUUM; -- should not propagate because no distributed table is specified insert into local_vacuum_table select i from generate_series(1,1000000) i; delete from local_vacuum_table; + +-- sometimes the vacuum doesn't clean up as expected and results in a flaky result +-- for our tests. For this reason, we re-run the vacuum command once if size of +-- the table before and after the VACUUM is not as expected +SELECT pg_total_relation_size('local_vacuum_table') AS size_before_vacuum \gset VACUUM local_vacuum_table; -SELECT CASE WHEN s BETWEEN 20000000 AND 25000000 THEN 22500000 ELSE s END -FROM pg_total_relation_size('local_vacuum_table') s ; +SELECT pg_total_relation_size('local_vacuum_table') AS size_after_vacuum \gset + +SELECT :size_before_vacuum <= :size_after_vacuum AS re_vacuum_needed \gset +\if :re_vacuum_needed +SELECT pg_total_relation_size('local_vacuum_table') AS size_before_vacuum \gset +VACUUM local_vacuum_table; +VACUUM local_vacuum_table; +VACUUM local_vacuum_table; +SELECT pg_total_relation_size('local_vacuum_table') AS size_after_vacuum \gset +\endif + +SELECT :size_before_vacuum > :size_after_vacuum AS vacuum_successful; -- vacuum full deallocates pages of dead tuples whereas normal vacuum only marks dead tuples on visibility map VACUUM FULL local_vacuum_table;