diff --git a/src/test/regress/expected/multi_colocation_utils.out b/src/test/regress/expected/multi_colocation_utils.out index dba77faa8..e93bb9a15 100644 --- a/src/test/regress/expected/multi_colocation_utils.out +++ b/src/test/regress/expected/multi_colocation_utils.out @@ -52,6 +52,16 @@ CREATE FUNCTION find_shard_interval_index(bigint) RETURNS int AS 'citus' LANGUAGE C STRICT; +-- remove tables from pg_dist_partition, if they don't exist i.e not found in pg_class +delete from pg_dist_partition where not exists(select * from pg_class where pg_class.oid=pg_dist_partition.logicalrelid); +select 1 from run_command_on_workers($$ + delete from pg_dist_partition where not exists(select * from pg_class where pg_class.oid=pg_dist_partition.logicalrelid);$$); + ?column? +--------------------------------------------------------------------- + 1 + 1 +(2 rows) + -- =================================================================== -- test co-location util functions -- =================================================================== @@ -958,6 +968,33 @@ SELECT update_distributed_table_colocation('table1_group_none', colocate_with => (1 row) +-- sync metadata to get rid of inconsistencies in pg_dist tables +select stop_metadata_sync_to_node('localhost', :worker_1_port); +NOTICE: dropping metadata on the node (localhost,57637) + stop_metadata_sync_to_node +--------------------------------------------------------------------- + +(1 row) + +select stop_metadata_sync_to_node('localhost', :worker_2_port); +NOTICE: dropping metadata on the node (localhost,57638) + stop_metadata_sync_to_node +--------------------------------------------------------------------- + +(1 row) + +select start_metadata_sync_to_node('localhost', :worker_1_port); + start_metadata_sync_to_node +--------------------------------------------------------------------- + +(1 row) + +select start_metadata_sync_to_node('localhost', :worker_2_port); + start_metadata_sync_to_node +--------------------------------------------------------------------- + +(1 row) + -- move a table with a colocation id which is already not in pg_dist_colocation SELECT update_distributed_table_colocation('table1_group_none', colocate_with => 'table2_group_none'); update_distributed_table_colocation diff --git a/src/test/regress/multi_1_schedule b/src/test/regress/multi_1_schedule index db9760a77..e909f8c7a 100644 --- a/src/test/regress/multi_1_schedule +++ b/src/test/regress/multi_1_schedule @@ -249,10 +249,7 @@ test: multi_truncate # multi_colocation_utils tests utility functions written for co-location feature & internal API # multi_colocated_shard_transfer tests master_copy_shard_placement with colocated tables. # ---------- -test: check_mx -test: turn_mx_off test: multi_colocation_utils -test: turn_mx_on test: multi_colocated_shard_transfer # ---------- diff --git a/src/test/regress/sql/multi_colocation_utils.sql b/src/test/regress/sql/multi_colocation_utils.sql index af33835d2..33324384f 100644 --- a/src/test/regress/sql/multi_colocation_utils.sql +++ b/src/test/regress/sql/multi_colocation_utils.sql @@ -62,6 +62,11 @@ CREATE FUNCTION find_shard_interval_index(bigint) AS 'citus' LANGUAGE C STRICT; +-- remove tables from pg_dist_partition, if they don't exist i.e not found in pg_class +delete from pg_dist_partition where not exists(select * from pg_class where pg_class.oid=pg_dist_partition.logicalrelid); +select 1 from run_command_on_workers($$ + delete from pg_dist_partition where not exists(select * from pg_class where pg_class.oid=pg_dist_partition.logicalrelid);$$); + -- =================================================================== -- test co-location util functions -- =================================================================== @@ -404,6 +409,12 @@ SELECT update_distributed_table_colocation('table1_group_none', colocate_with => SELECT update_distributed_table_colocation('table1_group_none', colocate_with => 'table2_groupE'); SELECT update_distributed_table_colocation('table1_group_none', colocate_with => 'table3_groupE'); +-- sync metadata to get rid of inconsistencies in pg_dist tables +select stop_metadata_sync_to_node('localhost', :worker_1_port); +select stop_metadata_sync_to_node('localhost', :worker_2_port); +select start_metadata_sync_to_node('localhost', :worker_1_port); +select start_metadata_sync_to_node('localhost', :worker_2_port); + -- move a table with a colocation id which is already not in pg_dist_colocation SELECT update_distributed_table_colocation('table1_group_none', colocate_with => 'table2_group_none');