From 9b8802ba2d55ff0e3ccd390c2e118f7516ff5257 Mon Sep 17 00:00:00 2001 From: Hadi Moshayedi Date: Tue, 7 Apr 2020 11:32:49 -0700 Subject: [PATCH] Remove todo from reference_table_utils --- .../distributed/utils/reference_table_utils.c | 10 - .../expected/multi_colocation_utils.out | 16 +- .../expected/multi_mx_create_table.out | 24 +-- .../multi_remove_node_reference_table.out | 90 ++++---- .../multi_upgrade_reference_table.out | 197 +++++++++--------- .../regress/sql/multi_colocation_utils.sql | 4 +- .../sql/multi_remove_node_reference_table.sql | 30 +-- .../sql/multi_upgrade_reference_table.sql | 68 +++--- 8 files changed, 219 insertions(+), 220 deletions(-) diff --git a/src/backend/distributed/utils/reference_table_utils.c b/src/backend/distributed/utils/reference_table_utils.c index ecf75ee23..558a67656 100644 --- a/src/backend/distributed/utils/reference_table_utils.c +++ b/src/backend/distributed/utils/reference_table_utils.c @@ -102,16 +102,6 @@ replicate_reference_tables(PG_FUNCTION_ARGS) void EnsureReferenceTablesExistOnAllNodes(void) { - /* - * TODO: remove this. This is here so we don't have to update regression test - * outputs because of reference table colocation id being changed. Specially - * multi_colocation_utils which requires the test itself being updated. - */ - if (ReferenceTableOidList() == NIL) - { - return; - } - /* * Prevent this function from running concurrently with itself. * diff --git a/src/test/regress/expected/multi_colocation_utils.out b/src/test/regress/expected/multi_colocation_utils.out index 26bfc21ba..a4996fa96 100644 --- a/src/test/regress/expected/multi_colocation_utils.out +++ b/src/test/regress/expected/multi_colocation_utils.out @@ -337,6 +337,13 @@ SELECT find_shard_interval_index(1300016); (1 row) -- check external colocation API +SELECT count(*) FROM pg_dist_partition WHERE colocationid = 4; + count +--------------------------------------------------------------------- + 0 +(1 row) + +DELETE FROM pg_dist_colocation WHERE colocationid = 4; SET citus.shard_count = 2; CREATE TABLE table1_groupA ( id int ); SELECT create_distributed_table('table1_groupA', 'id'); @@ -433,12 +440,11 @@ SELECT * FROM pg_dist_colocation ORDER BY colocationid; colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation --------------------------------------------------------------------- - 3 | 4 | 2 | 23 | 0 4 | 2 | 2 | 23 | 0 5 | 2 | 1 | 23 | 0 6 | 2 | 2 | 25 | 100 7 | 8 | 2 | 23 | 0 -(5 rows) +(4 rows) SELECT logicalrelid, colocationid FROM pg_dist_partition WHERE colocationid >= 1 AND colocationid < 1000 @@ -557,13 +563,12 @@ SELECT * FROM pg_dist_colocation ORDER BY colocationid; colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation --------------------------------------------------------------------- - 3 | 4 | 2 | 23 | 0 4 | 2 | 2 | 23 | 0 5 | 2 | 1 | 23 | 0 6 | 2 | 2 | 25 | 100 7 | 8 | 2 | 23 | 0 11 | 3 | 2 | 23 | 0 -(6 rows) +(5 rows) SELECT logicalrelid, colocationid FROM pg_dist_partition WHERE colocationid >= 1 AND colocationid < 1000 @@ -652,13 +657,12 @@ SELECT * FROM pg_dist_colocation ORDER BY colocationid; colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation --------------------------------------------------------------------- - 3 | 4 | 2 | 23 | 0 4 | 2 | 2 | 23 | 0 5 | 2 | 1 | 23 | 0 6 | 2 | 2 | 25 | 100 7 | 8 | 2 | 23 | 0 11 | 3 | 2 | 23 | 0 -(6 rows) +(5 rows) -- cross check with internal colocation API SELECT diff --git a/src/test/regress/expected/multi_mx_create_table.out b/src/test/regress/expected/multi_mx_create_table.out index e64a49439..9db4ce9e0 100644 --- a/src/test/regress/expected/multi_mx_create_table.out +++ b/src/test/regress/expected/multi_mx_create_table.out @@ -454,18 +454,18 @@ FROM pg_dist_partition NATURAL JOIN shard_counts ORDER BY colocationid, logicalrelid; logicalrelid | colocationid | shard_count | partmethod | repmodel --------------------------------------------------------------------- - citus_mx_test_schema_join_1.nation_hash | 1390002 | 4 | h | s - citus_mx_test_schema_join_1.nation_hash_2 | 1390002 | 4 | h | s - citus_mx_test_schema_join_2.nation_hash | 1390002 | 4 | h | s - citus_mx_test_schema.nation_hash_collation_search_path | 1390002 | 4 | h | s - citus_mx_test_schema.nation_hash_composite_types | 1390002 | 4 | h | s - mx_ddl_table | 1390002 | 4 | h | s - app_analytics_events_mx | 1390002 | 4 | h | s - company_employees_mx | 1390002 | 4 | h | s - customer_mx | 1390004 | 1 | n | t - nation_mx | 1390004 | 1 | n | t - part_mx | 1390004 | 1 | n | t - supplier_mx | 1390004 | 1 | n | t + customer_mx | 1390001 | 1 | n | t + nation_mx | 1390001 | 1 | n | t + part_mx | 1390001 | 1 | n | t + supplier_mx | 1390001 | 1 | n | t + citus_mx_test_schema_join_1.nation_hash | 1390003 | 4 | h | s + citus_mx_test_schema_join_1.nation_hash_2 | 1390003 | 4 | h | s + citus_mx_test_schema_join_2.nation_hash | 1390003 | 4 | h | s + citus_mx_test_schema.nation_hash_collation_search_path | 1390003 | 4 | h | s + citus_mx_test_schema.nation_hash_composite_types | 1390003 | 4 | h | s + mx_ddl_table | 1390003 | 4 | h | s + app_analytics_events_mx | 1390003 | 4 | h | s + company_employees_mx | 1390003 | 4 | h | s nation_hash | 1390006 | 16 | h | s citus_mx_test_schema.nation_hash | 1390006 | 16 | h | s lineitem_mx | 1390007 | 16 | h | s diff --git a/src/test/regress/expected/multi_remove_node_reference_table.out b/src/test/regress/expected/multi_remove_node_reference_table.out index f30915788..e7722fd85 100644 --- a/src/test/regress/expected/multi_remove_node_reference_table.out +++ b/src/test/regress/expected/multi_remove_node_reference_table.out @@ -135,15 +135,15 @@ WHERE 1380000 | 1 | 0 | localhost | 57638 (1 row) -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid FROM pg_dist_partition WHERE logicalrelid = 'remove_node_reference_table'::regclass); - colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation + shardcount | replicationfactor | distributioncolumntype --------------------------------------------------------------------- - 10004 | 1 | -1 | 0 | 0 + 1 | -1 | 0 (1 row) \c - - - :worker_1_port @@ -188,15 +188,15 @@ WHERE --------------------------------------------------------------------- (0 rows) -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid FROM pg_dist_partition WHERE logicalrelid = 'remove_node_reference_table'::regclass); - colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation + shardcount | replicationfactor | distributioncolumntype --------------------------------------------------------------------- - 10004 | 1 | -1 | 0 | 0 + 1 | -1 | 0 (1 row) \c - - - :worker_1_port @@ -266,15 +266,15 @@ WHERE --------------------------------------------------------------------- (0 rows) -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid FROM pg_dist_partition WHERE logicalrelid = 'remove_node_reference_table'::regclass); - colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation + shardcount | replicationfactor | distributioncolumntype --------------------------------------------------------------------- - 10004 | 1 | -1 | 0 | 0 + 1 | -1 | 0 (1 row) \c - - - :worker_1_port @@ -320,15 +320,15 @@ WHERE --------------------------------------------------------------------- (0 rows) -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid FROM pg_dist_partition WHERE logicalrelid = 'remove_node_reference_table'::regclass); - colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation + shardcount | replicationfactor | distributioncolumntype --------------------------------------------------------------------- - 10004 | 1 | -1 | 0 | 0 + 1 | -1 | 0 (1 row) \c - - - :worker_1_port @@ -367,15 +367,15 @@ WHERE --------------------------------------------------------------------- (0 rows) -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid FROM pg_dist_partition WHERE logicalrelid = 'remove_node_reference_table'::regclass); - colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation + shardcount | replicationfactor | distributioncolumntype --------------------------------------------------------------------- - 10004 | 1 | -1 | 0 | 0 + 1 | -1 | 0 (1 row) \c - - - :worker_1_port @@ -421,15 +421,15 @@ WHERE --------------------------------------------------------------------- (0 rows) -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid FROM pg_dist_partition WHERE logicalrelid = 'remove_node_reference_table'::regclass); - colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation + shardcount | replicationfactor | distributioncolumntype --------------------------------------------------------------------- - 10004 | 1 | -1 | 0 | 0 + 1 | -1 | 0 (1 row) \c - - - :worker_1_port @@ -476,15 +476,15 @@ WHERE --------------------------------------------------------------------- (0 rows) -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid FROM pg_dist_partition WHERE logicalrelid = 'remove_node_reference_table'::regclass); - colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation + shardcount | replicationfactor | distributioncolumntype --------------------------------------------------------------------- - 10004 | 1 | -1 | 0 | 0 + 1 | -1 | 0 (1 row) \c - - - :worker_1_port @@ -531,15 +531,15 @@ WHERE --------------------------------------------------------------------- (0 rows) -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid FROM pg_dist_partition WHERE logicalrelid = 'remove_node_reference_table'::regclass); - colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation + shardcount | replicationfactor | distributioncolumntype --------------------------------------------------------------------- - 10004 | 1 | -1 | 0 | 0 + 1 | -1 | 0 (1 row) --verify the data is inserted @@ -599,15 +599,15 @@ WHERE --------------------------------------------------------------------- (0 rows) -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid FROM pg_dist_partition WHERE logicalrelid = 'remove_node_reference_table'::regclass); - colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation + shardcount | replicationfactor | distributioncolumntype --------------------------------------------------------------------- - 10004 | 1 | -1 | 0 | 0 + 1 | -1 | 0 (1 row) \c - - - :worker_1_port @@ -654,15 +654,15 @@ WHERE --------------------------------------------------------------------- (0 rows) -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid FROM pg_dist_partition WHERE logicalrelid = 'remove_node_reference_table'::regclass); - colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation + shardcount | replicationfactor | distributioncolumntype --------------------------------------------------------------------- - 10004 | 1 | -1 | 0 | 0 + 1 | -1 | 0 (1 row) \c - - - :worker_1_port @@ -718,15 +718,15 @@ WHERE --------------------------------------------------------------------- (0 rows) -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid FROM pg_dist_partition WHERE logicalrelid = 'remove_node_reference_table'::regclass); - colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation + shardcount | replicationfactor | distributioncolumntype --------------------------------------------------------------------- - 10004 | 1 | -1 | 0 | 0 + 1 | -1 | 0 (1 row) BEGIN; @@ -805,15 +805,15 @@ ORDER BY 1380002 | 1 | 0 | localhost | 57638 (2 rows) -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid FROM pg_dist_partition WHERE logicalrelid = 'remove_node_reference_table_schema.table1'::regclass); - colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation + shardcount | replicationfactor | distributioncolumntype --------------------------------------------------------------------- - 10004 | 1 | -1 | 0 | 0 + 1 | -1 | 0 (1 row) \c - - - :worker_1_port @@ -861,15 +861,15 @@ WHERE --------------------------------------------------------------------- (0 rows) -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid FROM pg_dist_partition WHERE logicalrelid = 'remove_node_reference_table_schema.table1'::regclass); - colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation + shardcount | replicationfactor | distributioncolumntype --------------------------------------------------------------------- - 10004 | 1 | -1 | 0 | 0 + 1 | -1 | 0 (1 row) \c - - - :worker_1_port @@ -918,15 +918,15 @@ ORDER BY --------------------------------------------------------------------- (0 rows) -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid FROM pg_dist_partition WHERE logicalrelid = 'remove_node_reference_table'::regclass); - colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation + shardcount | replicationfactor | distributioncolumntype --------------------------------------------------------------------- - 10004 | 1 | -1 | 0 | 0 + 1 | -1 | 0 (1 row) \c - - - :worker_1_port @@ -971,15 +971,15 @@ WHERE --------------------------------------------------------------------- (0 rows) -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid FROM pg_dist_partition WHERE logicalrelid = 'remove_node_reference_table'::regclass); - colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation + shardcount | replicationfactor | distributioncolumntype --------------------------------------------------------------------- - 10004 | 1 | -1 | 0 | 0 + 1 | -1 | 0 (1 row) \c - - - :worker_1_port diff --git a/src/test/regress/expected/multi_upgrade_reference_table.out b/src/test/regress/expected/multi_upgrade_reference_table.out index 010bf690a..14efe2274 100644 --- a/src/test/regress/expected/multi_upgrade_reference_table.out +++ b/src/test/regress/expected/multi_upgrade_reference_table.out @@ -126,16 +126,17 @@ SELECT create_distributed_table('upgrade_reference_table_append', 'column1', 'ap (1 row) COPY upgrade_reference_table_append FROM STDIN; +SELECT colocationid AS reference_table_colocationid FROM pg_dist_colocation WHERE distributioncolumntype=0 \gset -- situation before upgrade_reference_table SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_append'::regclass; - partmethod | partkeyisnull | colocationid | repmodel + partmethod | partkeyisnull | has_reference_table_colocation_id | repmodel --------------------------------------------------------------------- - a | f | 0 | c + a | f | f | c (1 row) SELECT @@ -149,13 +150,13 @@ WHERE 1360009 | f | f (1 row) -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_append'::regclass); - colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation + shardcount | replicationfactor | distributioncolumntype --------------------------------------------------------------------- (0 rows) @@ -182,14 +183,14 @@ SELECT upgrade_to_reference_table('upgrade_reference_table_append'); -- situation after upgrade_reference_table SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_append'::regclass; - partmethod | partkeyisnull | colocationid | repmodel + partmethod | partkeyisnull | has_reference_table_colocation_id | repmodel --------------------------------------------------------------------- - n | t | 10004 | t + n | t | t | t (1 row) SELECT @@ -203,15 +204,15 @@ WHERE 1360009 | t | t (1 row) -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_append'::regclass); - colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation + shardcount | replicationfactor | distributioncolumntype --------------------------------------------------------------------- - 10004 | 1 | -1 | 0 | 0 + 1 | -1 | 0 (1 row) SELECT @@ -240,14 +241,14 @@ SELECT create_distributed_table('upgrade_reference_table_one_worker', 'column1') UPDATE pg_dist_partition SET repmodel='c' WHERE logicalrelid='upgrade_reference_table_one_worker'::regclass; -- situation before upgrade_reference_table SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_one_worker'::regclass; - partmethod | partkeyisnull | colocationid | repmodel + partmethod | partkeyisnull | has_reference_table_colocation_id | repmodel --------------------------------------------------------------------- - h | f | 1360001 | c + h | f | f | c (1 row) SELECT @@ -261,15 +262,15 @@ WHERE 1360010 | f | f (1 row) -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_one_worker'::regclass); - colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation + shardcount | replicationfactor | distributioncolumntype --------------------------------------------------------------------- - 1360001 | 1 | 1 | 23 | 0 + 1 | 1 | 23 (1 row) SELECT @@ -294,14 +295,14 @@ SELECT upgrade_to_reference_table('upgrade_reference_table_one_worker'); -- situation after upgrade_reference_table SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_one_worker'::regclass; - partmethod | partkeyisnull | colocationid | repmodel + partmethod | partkeyisnull | has_reference_table_colocation_id | repmodel --------------------------------------------------------------------- - n | t | 10004 | t + n | t | t | t (1 row) SELECT @@ -315,15 +316,15 @@ WHERE 1360010 | t | t (1 row) -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_one_worker'::regclass); - colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation + shardcount | replicationfactor | distributioncolumntype --------------------------------------------------------------------- - 10004 | 1 | -1 | 0 | 0 + 1 | -1 | 0 (1 row) SELECT @@ -354,14 +355,14 @@ UPDATE pg_dist_shard_placement SET shardstate = 3 WHERE shardid = (SELECT shardid FROM pg_dist_shard WHERE logicalrelid = 'upgrade_reference_table_one_unhealthy'::regclass::oid) AND nodeport = :worker_1_port; -- situation before upgrade_reference_table SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_one_unhealthy'::regclass; - partmethod | partkeyisnull | colocationid | repmodel + partmethod | partkeyisnull | has_reference_table_colocation_id | repmodel --------------------------------------------------------------------- - h | f | 1360002 | c + h | f | f | c (1 row) SELECT @@ -375,15 +376,15 @@ WHERE 1360011 | f | f (1 row) -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_one_unhealthy'::regclass); - colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation + shardcount | replicationfactor | distributioncolumntype --------------------------------------------------------------------- - 1360002 | 1 | 2 | 23 | 0 + 1 | 2 | 23 (1 row) SELECT @@ -409,14 +410,14 @@ SELECT upgrade_to_reference_table('upgrade_reference_table_one_unhealthy'); -- situation after upgrade_reference_table SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_one_unhealthy'::regclass; - partmethod | partkeyisnull | colocationid | repmodel + partmethod | partkeyisnull | has_reference_table_colocation_id | repmodel --------------------------------------------------------------------- - n | t | 10004 | t + n | t | t | t (1 row) SELECT @@ -430,15 +431,15 @@ WHERE 1360011 | t | t (1 row) -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_one_unhealthy'::regclass); - colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation + shardcount | replicationfactor | distributioncolumntype --------------------------------------------------------------------- - 10004 | 1 | -1 | 0 | 0 + 1 | -1 | 0 (1 row) SELECT @@ -467,14 +468,14 @@ SELECT create_distributed_table('upgrade_reference_table_both_healthy', 'column1 -- situation before upgrade_reference_table SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_both_healthy'::regclass; - partmethod | partkeyisnull | colocationid | repmodel + partmethod | partkeyisnull | has_reference_table_colocation_id | repmodel --------------------------------------------------------------------- - h | f | 1360003 | c + h | f | f | c (1 row) SELECT @@ -488,15 +489,15 @@ WHERE 1360012 | f | f (1 row) -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_both_healthy'::regclass); - colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation + shardcount | replicationfactor | distributioncolumntype --------------------------------------------------------------------- - 1360003 | 1 | 2 | 23 | 0 + 1 | 2 | 23 (1 row) SELECT @@ -521,14 +522,14 @@ SELECT upgrade_to_reference_table('upgrade_reference_table_both_healthy'); -- situation after upgrade_reference_table SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_both_healthy'::regclass; - partmethod | partkeyisnull | colocationid | repmodel + partmethod | partkeyisnull | has_reference_table_colocation_id | repmodel --------------------------------------------------------------------- - n | t | 10004 | t + n | t | t | t (1 row) SELECT @@ -542,15 +543,15 @@ WHERE 1360012 | t | t (1 row) -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_both_healthy'::regclass); - colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation + shardcount | replicationfactor | distributioncolumntype --------------------------------------------------------------------- - 10004 | 1 | -1 | 0 | 0 + 1 | -1 | 0 (1 row) SELECT @@ -580,14 +581,14 @@ SELECT create_distributed_table('upgrade_reference_table_transaction_rollback', UPDATE pg_dist_partition SET repmodel='c' WHERE logicalrelid='upgrade_reference_table_transaction_rollback'::regclass; -- situation before upgrade_reference_table SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_transaction_rollback'::regclass; - partmethod | partkeyisnull | colocationid | repmodel + partmethod | partkeyisnull | has_reference_table_colocation_id | repmodel --------------------------------------------------------------------- - h | f | 1360004 | c + h | f | f | c (1 row) SELECT @@ -601,15 +602,15 @@ WHERE 1360013 | f | f (1 row) -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_transaction_rollback'::regclass); - colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation + shardcount | replicationfactor | distributioncolumntype --------------------------------------------------------------------- - 1360004 | 1 | 1 | 23 | 0 + 1 | 1 | 23 (1 row) SELECT @@ -636,14 +637,14 @@ SELECT upgrade_to_reference_table('upgrade_reference_table_transaction_rollback' ROLLBACK; -- situation after upgrade_reference_table SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_transaction_rollback'::regclass; - partmethod | partkeyisnull | colocationid | repmodel + partmethod | partkeyisnull | has_reference_table_colocation_id | repmodel --------------------------------------------------------------------- - h | f | 1360004 | c + h | f | f | c (1 row) SELECT @@ -657,15 +658,15 @@ WHERE 1360013 | f | f (1 row) -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_transaction_rollback'::regclass); - colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation + shardcount | replicationfactor | distributioncolumntype --------------------------------------------------------------------- - 1360004 | 1 | 1 | 23 | 0 + 1 | 1 | 23 (1 row) SELECT @@ -695,14 +696,14 @@ SELECT create_distributed_table('upgrade_reference_table_transaction_commit', 'c UPDATE pg_dist_partition SET repmodel='c' WHERE logicalrelid='upgrade_reference_table_transaction_commit'::regclass; -- situation before upgrade_reference_table SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_transaction_commit'::regclass; - partmethod | partkeyisnull | colocationid | repmodel + partmethod | partkeyisnull | has_reference_table_colocation_id | repmodel --------------------------------------------------------------------- - h | f | 1360004 | c + h | f | f | c (1 row) SELECT @@ -716,15 +717,15 @@ WHERE 1360014 | f | f (1 row) -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_transaction_commit'::regclass); - colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation + shardcount | replicationfactor | distributioncolumntype --------------------------------------------------------------------- - 1360004 | 1 | 1 | 23 | 0 + 1 | 1 | 23 (1 row) SELECT @@ -751,14 +752,14 @@ SELECT upgrade_to_reference_table('upgrade_reference_table_transaction_commit'); COMMIT; -- situation after upgrade_reference_table SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_transaction_commit'::regclass; - partmethod | partkeyisnull | colocationid | repmodel + partmethod | partkeyisnull | has_reference_table_colocation_id | repmodel --------------------------------------------------------------------- - n | t | 10004 | t + n | t | t | t (1 row) SELECT @@ -772,15 +773,15 @@ WHERE 1360014 | t | t (1 row) -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_transaction_commit'::regclass); - colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation + shardcount | replicationfactor | distributioncolumntype --------------------------------------------------------------------- - 10004 | 1 | -1 | 0 | 0 + 1 | -1 | 0 (1 row) SELECT @@ -821,14 +822,14 @@ SELECT create_distributed_table('upgrade_reference_table_mx', 'column1'); -- verify that streaming replicated tables cannot be upgraded to reference tables SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_mx'::regclass; - partmethod | partkeyisnull | colocationid | repmodel + partmethod | partkeyisnull | has_reference_table_colocation_id | repmodel --------------------------------------------------------------------- - h | f | 1360005 | s + h | f | f | s (1 row) SELECT @@ -842,15 +843,15 @@ WHERE 1360015 | f | f (1 row) -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_mx'::regclass); - colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation + shardcount | replicationfactor | distributioncolumntype --------------------------------------------------------------------- - 1360005 | 1 | 1 | 23 | 0 + 1 | 1 | 23 (1 row) SELECT @@ -872,14 +873,14 @@ ERROR: cannot upgrade to reference table DETAIL: Upgrade is only supported for statement-based replicated tables but "upgrade_reference_table_mx" is streaming replicated -- situation after upgrade_reference_table SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_mx'::regclass; - partmethod | partkeyisnull | colocationid | repmodel + partmethod | partkeyisnull | has_reference_table_colocation_id | repmodel --------------------------------------------------------------------- - h | f | 1360005 | s + h | f | f | s (1 row) SELECT @@ -893,15 +894,15 @@ WHERE 1360015 | f | f (1 row) -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_mx'::regclass); - colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation + shardcount | replicationfactor | distributioncolumntype --------------------------------------------------------------------- - 1360005 | 1 | 1 | 23 | 0 + 1 | 1 | 23 (1 row) SELECT @@ -941,14 +942,14 @@ SELECT start_metadata_sync_to_node('localhost', :worker_1_port); -- situation before upgrade_reference_table SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_mx'::regclass; - partmethod | partkeyisnull | colocationid | repmodel + partmethod | partkeyisnull | has_reference_table_colocation_id | repmodel --------------------------------------------------------------------- - h | f | 1360006 | c + h | f | f | c (1 row) SELECT @@ -962,15 +963,15 @@ WHERE 1360016 | f | f (1 row) -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_mx'::regclass); - colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation + shardcount | replicationfactor | distributioncolumntype --------------------------------------------------------------------- - 1360006 | 1 | 2 | 23 | 0 + 1 | 2 | 23 (1 row) SELECT @@ -996,14 +997,14 @@ SELECT upgrade_to_reference_table('upgrade_reference_table_mx'); -- situation after upgrade_reference_table SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_mx'::regclass; - partmethod | partkeyisnull | colocationid | repmodel + partmethod | partkeyisnull | has_reference_table_colocation_id | repmodel --------------------------------------------------------------------- - n | t | 10004 | t + n | t | t | t (1 row) SELECT @@ -1017,15 +1018,15 @@ WHERE 1360016 | t | t (1 row) -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_mx'::regclass); - colocationid | shardcount | replicationfactor | distributioncolumntype | distributioncolumncollation + shardcount | replicationfactor | distributioncolumntype --------------------------------------------------------------------- - 10004 | 1 | -1 | 0 | 0 + 1 | -1 | 0 (1 row) SELECT @@ -1045,14 +1046,14 @@ ORDER BY shardid; -- situation on metadata worker \c - - - :worker_1_port SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE logicalrelid = 'upgrade_reference_table_mx'::regclass; - partmethod | partkeyisnull | colocationid | repmodel + partmethod | partkeyisnull | has_reference_table_colocation_id | repmodel --------------------------------------------------------------------- - n | t | 10004 | t + n | t | t | t (1 row) SELECT diff --git a/src/test/regress/sql/multi_colocation_utils.sql b/src/test/regress/sql/multi_colocation_utils.sql index e81de3d39..55f563234 100644 --- a/src/test/regress/sql/multi_colocation_utils.sql +++ b/src/test/regress/sql/multi_colocation_utils.sql @@ -151,9 +151,11 @@ SELECT find_shard_interval_index(1300002); SELECT find_shard_interval_index(1300003); SELECT find_shard_interval_index(1300016); - -- check external colocation API +SELECT count(*) FROM pg_dist_partition WHERE colocationid = 4; +DELETE FROM pg_dist_colocation WHERE colocationid = 4; + SET citus.shard_count = 2; CREATE TABLE table1_groupA ( id int ); diff --git a/src/test/regress/sql/multi_remove_node_reference_table.sql b/src/test/regress/sql/multi_remove_node_reference_table.sql index 376171d20..b9581924d 100644 --- a/src/test/regress/sql/multi_remove_node_reference_table.sql +++ b/src/test/regress/sql/multi_remove_node_reference_table.sql @@ -65,7 +65,7 @@ FROM WHERE nodeport = :worker_2_port; -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid @@ -97,7 +97,7 @@ FROM WHERE nodeport = :worker_2_port; -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid @@ -143,7 +143,7 @@ FROM WHERE nodeport = :worker_2_port; -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid @@ -177,7 +177,7 @@ FROM WHERE nodeport = :worker_2_port; -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid @@ -209,7 +209,7 @@ FROM WHERE nodeport = :worker_2_port; -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid @@ -243,7 +243,7 @@ FROM WHERE nodeport = :worker_2_port; -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid @@ -279,7 +279,7 @@ FROM WHERE nodeport = :worker_2_port; -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid @@ -314,7 +314,7 @@ FROM WHERE nodeport = :worker_2_port; -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid @@ -356,7 +356,7 @@ FROM WHERE nodeport = :worker_2_port; -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid @@ -391,7 +391,7 @@ FROM WHERE nodeport = :worker_2_port; -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid @@ -433,7 +433,7 @@ FROM WHERE nodeport = :worker_2_port; -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid @@ -481,7 +481,7 @@ WHERE ORDER BY shardid; -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid @@ -514,7 +514,7 @@ FROM WHERE nodeport = :worker_2_port; -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid @@ -553,7 +553,7 @@ WHERE ORDER BY shardid; -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid @@ -586,7 +586,7 @@ FROM WHERE nodeport = :worker_2_port; -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid diff --git a/src/test/regress/sql/multi_upgrade_reference_table.sql b/src/test/regress/sql/multi_upgrade_reference_table.sql index f70931ca2..4bd8d6706 100644 --- a/src/test/regress/sql/multi_upgrade_reference_table.sql +++ b/src/test/regress/sql/multi_upgrade_reference_table.sql @@ -89,9 +89,11 @@ COPY upgrade_reference_table_append FROM STDIN; 5 \. +SELECT colocationid AS reference_table_colocationid FROM pg_dist_colocation WHERE distributioncolumntype=0 \gset + -- situation before upgrade_reference_table SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE @@ -104,7 +106,7 @@ FROM WHERE logicalrelid = 'upgrade_reference_table_append'::regclass; -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid @@ -127,7 +129,7 @@ SELECT upgrade_to_reference_table('upgrade_reference_table_append'); -- situation after upgrade_reference_table SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE @@ -140,7 +142,7 @@ FROM WHERE logicalrelid = 'upgrade_reference_table_append'::regclass; -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid @@ -166,7 +168,7 @@ UPDATE pg_dist_partition SET repmodel='c' WHERE logicalrelid='upgrade_reference_ -- situation before upgrade_reference_table SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE @@ -179,7 +181,7 @@ FROM WHERE logicalrelid = 'upgrade_reference_table_one_worker'::regclass; -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid @@ -200,7 +202,7 @@ SELECT upgrade_to_reference_table('upgrade_reference_table_one_worker'); -- situation after upgrade_reference_table SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE @@ -213,7 +215,7 @@ FROM WHERE logicalrelid = 'upgrade_reference_table_one_worker'::regclass; -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid @@ -241,7 +243,7 @@ WHERE shardid = (SELECT shardid FROM pg_dist_shard WHERE logicalrelid = 'upgrade -- situation before upgrade_reference_table SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE @@ -254,7 +256,7 @@ FROM WHERE logicalrelid = 'upgrade_reference_table_one_unhealthy'::regclass; -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid @@ -276,7 +278,7 @@ SELECT upgrade_to_reference_table('upgrade_reference_table_one_unhealthy'); -- situation after upgrade_reference_table SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE @@ -289,7 +291,7 @@ FROM WHERE logicalrelid = 'upgrade_reference_table_one_unhealthy'::regclass; -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid @@ -315,7 +317,7 @@ SELECT create_distributed_table('upgrade_reference_table_both_healthy', 'column1 -- situation before upgrade_reference_table SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE @@ -328,7 +330,7 @@ FROM WHERE logicalrelid = 'upgrade_reference_table_both_healthy'::regclass; -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid @@ -349,7 +351,7 @@ SELECT upgrade_to_reference_table('upgrade_reference_table_both_healthy'); -- situation after upgrade_reference_table SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE @@ -362,7 +364,7 @@ FROM WHERE logicalrelid = 'upgrade_reference_table_both_healthy'::regclass; -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid @@ -389,7 +391,7 @@ UPDATE pg_dist_partition SET repmodel='c' WHERE logicalrelid='upgrade_reference_ -- situation before upgrade_reference_table SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE @@ -402,7 +404,7 @@ FROM WHERE logicalrelid = 'upgrade_reference_table_transaction_rollback'::regclass; -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid @@ -425,7 +427,7 @@ ROLLBACK; -- situation after upgrade_reference_table SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE @@ -438,7 +440,7 @@ FROM WHERE logicalrelid = 'upgrade_reference_table_transaction_rollback'::regclass; -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid @@ -466,7 +468,7 @@ UPDATE pg_dist_partition SET repmodel='c' WHERE logicalrelid='upgrade_reference_ -- situation before upgrade_reference_table SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE @@ -479,7 +481,7 @@ FROM WHERE logicalrelid = 'upgrade_reference_table_transaction_commit'::regclass; -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid @@ -502,7 +504,7 @@ COMMIT; -- situation after upgrade_reference_table SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE @@ -515,7 +517,7 @@ FROM WHERE logicalrelid = 'upgrade_reference_table_transaction_commit'::regclass; -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid @@ -548,7 +550,7 @@ SELECT create_distributed_table('upgrade_reference_table_mx', 'column1'); -- verify that streaming replicated tables cannot be upgraded to reference tables SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE @@ -561,7 +563,7 @@ FROM WHERE logicalrelid = 'upgrade_reference_table_mx'::regclass; -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid @@ -584,7 +586,7 @@ SELECT upgrade_to_reference_table('upgrade_reference_table_mx'); -- situation after upgrade_reference_table SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE @@ -597,7 +599,7 @@ FROM WHERE logicalrelid = 'upgrade_reference_table_mx'::regclass; -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid @@ -630,7 +632,7 @@ SELECT start_metadata_sync_to_node('localhost', :worker_1_port); -- situation before upgrade_reference_table SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE @@ -643,7 +645,7 @@ FROM WHERE logicalrelid = 'upgrade_reference_table_mx'::regclass; -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid @@ -666,7 +668,7 @@ SELECT upgrade_to_reference_table('upgrade_reference_table_mx'); -- situation after upgrade_reference_table SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE @@ -679,7 +681,7 @@ FROM WHERE logicalrelid = 'upgrade_reference_table_mx'::regclass; -SELECT * +SELECT shardcount, replicationfactor, distributioncolumntype FROM pg_dist_colocation WHERE colocationid IN (SELECT colocationid @@ -699,7 +701,7 @@ ORDER BY shardid; -- situation on metadata worker \c - - - :worker_1_port SELECT - partmethod, (partkey IS NULL) as partkeyisnull, colocationid, repmodel + partmethod, (partkey IS NULL) as partkeyisnull, colocationid = :reference_table_colocationid AS has_reference_table_colocation_id, repmodel FROM pg_dist_partition WHERE