diff --git a/src/backend/distributed/Makefile b/src/backend/distributed/Makefile index 1ea5260b6..453c74af2 100644 --- a/src/backend/distributed/Makefile +++ b/src/backend/distributed/Makefile @@ -11,7 +11,7 @@ EXTVERSIONS = 5.0 5.0-1 5.0-2 \ 6.0-1 6.0-2 6.0-3 6.0-4 6.0-5 6.0-6 6.0-7 6.0-8 6.0-9 6.0-10 6.0-11 6.0-12 6.0-13 6.0-14 6.0-15 6.0-16 6.0-17 6.0-18 \ 6.1-1 6.1-2 6.1-3 6.1-4 6.1-5 6.1-6 6.1-7 6.1-8 6.1-9 6.1-10 6.1-11 6.1-12 6.1-13 6.1-14 6.1-15 6.1-16 6.1-17 \ 6.2-1 6.2-2 6.2-3 6.2-4 \ - 7.0-1 7.0-2 7.0-3 7.0-4 7.0-5 7.0-6 7.0-7 7.0-8 7.0-9 7.0-10 7.0-11 7.0-12 + 7.0-1 7.0-2 7.0-3 7.0-4 7.0-5 7.0-6 7.0-7 7.0-8 7.0-9 7.0-10 7.0-11 7.0-12 7.0-13 # All citus--*.sql files in the source directory DATA = $(patsubst $(citus_abs_srcdir)/%.sql,%.sql,$(wildcard $(citus_abs_srcdir)/$(EXTENSION)--*--*.sql)) @@ -163,6 +163,8 @@ $(EXTENSION)--7.0-11.sql: $(EXTENSION)--7.0-10.sql $(EXTENSION)--7.0-10--7.0-11. cat $^ > $@ $(EXTENSION)--7.0-12.sql: $(EXTENSION)--7.0-11.sql $(EXTENSION)--7.0-11--7.0-12.sql cat $^ > $@ +$(EXTENSION)--7.0-13.sql: $(EXTENSION)--7.0-12.sql $(EXTENSION)--7.0-12--7.0-13.sql + cat $^ > $@ NO_PGXS = 1 diff --git a/src/backend/distributed/citus--7.0-12--7.0-13.sql b/src/backend/distributed/citus--7.0-12--7.0-13.sql new file mode 100644 index 000000000..f568a54d0 --- /dev/null +++ b/src/backend/distributed/citus--7.0-12--7.0-13.sql @@ -0,0 +1,46 @@ +/* citus--7.0-12--7.0-13.sql */ + +SET search_path = 'pg_catalog'; + +CREATE OR REPLACE FUNCTION pg_catalog.citus_drop_trigger() + RETURNS event_trigger + LANGUAGE plpgsql + SECURITY DEFINER + SET search_path = pg_catalog + AS $cdbdt$ +DECLARE + v_obj record; + sequence_names text[] := '{}'; + table_colocation_id integer; + propagate_drop boolean := false; +BEGIN + -- collect set of dropped sequences to drop on workers later + SELECT array_agg(object_identity) INTO sequence_names + FROM pg_event_trigger_dropped_objects() + WHERE object_type = 'sequence'; + + FOR v_obj IN SELECT * FROM pg_event_trigger_dropped_objects() JOIN + pg_dist_partition ON (logicalrelid = objid) + WHERE object_type IN ('table', 'foreign table') + LOOP + -- get colocation group + SELECT colocationid INTO table_colocation_id FROM pg_dist_partition WHERE logicalrelid = v_obj.objid; + + -- ensure all shards are dropped + PERFORM master_drop_all_shards(v_obj.objid, v_obj.schema_name, v_obj.object_name); + + PERFORM master_drop_distributed_table_metadata(v_obj.objid, v_obj.schema_name, v_obj.object_name); + END LOOP; + + IF cardinality(sequence_names) = 0 THEN + RETURN; + END IF; + + PERFORM master_drop_sequences(sequence_names); +END; +$cdbdt$; + +COMMENT ON FUNCTION citus_drop_trigger() + IS 'perform checks and actions at the end of DROP actions'; + +RESET search_path; diff --git a/src/backend/distributed/citus.control b/src/backend/distributed/citus.control index 9311aa71f..89004f75f 100644 --- a/src/backend/distributed/citus.control +++ b/src/backend/distributed/citus.control @@ -1,6 +1,6 @@ # Citus extension comment = 'Citus distributed database' -default_version = '7.0-12' +default_version = '7.0-13' module_pathname = '$libdir/citus' relocatable = false schema = pg_catalog diff --git a/src/backend/distributed/commands/create_distributed_table.c b/src/backend/distributed/commands/create_distributed_table.c index f601237de..48b5b069d 100644 --- a/src/backend/distributed/commands/create_distributed_table.c +++ b/src/backend/distributed/commands/create_distributed_table.c @@ -311,14 +311,6 @@ CreateDistributedTable(Oid relationId, Var *distributionColumn, char distributio /* we need to calculate these variables before creating distributed metadata */ localTableEmpty = LocalTableEmpty(relationId); colocatedTableId = ColocatedTableId(colocationId); - if (colocatedTableId != InvalidOid) - { - /* - * We take lock on colocatedTableId, because we want to ensure that colocated - * table is not dropped until we create all colocated shards. - */ - colocatedRelation = relation_open(colocatedTableId, AccessShareLock); - } /* create an entry for distributed table in pg_dist_partition */ InsertIntoPgDistPartition(relationId, distributionMethod, distributionColumn, @@ -530,6 +522,7 @@ ColocationIdForNewTable(Oid relationId, Var *distributionColumn, Relation pgDistColocation = heap_open(DistColocationRelationId(), ExclusiveLock); Oid distributionColumnType = distributionColumn->vartype; + bool createdColocationGroup = false; if (pg_strncasecmp(colocateWithTableName, "default", NAMEDATALEN) == 0) { @@ -541,11 +534,14 @@ ColocationIdForNewTable(Oid relationId, Var *distributionColumn, { colocationId = CreateColocationGroup(ShardCount, ShardReplicationFactor, distributionColumnType); + createdColocationGroup = true; } } else if (pg_strncasecmp(colocateWithTableName, "none", NAMEDATALEN) == 0) { colocationId = GetNextColocationId(); + + createdColocationGroup = true; } else { @@ -558,7 +554,22 @@ ColocationIdForNewTable(Oid relationId, Var *distributionColumn, colocationId = TableColocationId(sourceRelationId); } - heap_close(pgDistColocation, NoLock); + /* + * If we created a new colocation group then we need to keep the lock to + * prevent a concurrent create_distributed_table call from creating another + * colocation group with the same parameters. If we're using an existing + * colocation group then other transactions will use the same one. + */ + if (createdColocationGroup) + { + /* keep the exclusive lock */ + heap_close(pgDistColocation, NoLock); + } + else + { + /* release the exclusive lock */ + heap_close(pgDistColocation, ExclusiveLock); + } } return colocationId; diff --git a/src/backend/distributed/utils/colocation_utils.c b/src/backend/distributed/utils/colocation_utils.c index 7a494f753..076c29d54 100644 --- a/src/backend/distributed/utils/colocation_utils.c +++ b/src/backend/distributed/utils/colocation_utils.c @@ -31,6 +31,7 @@ #include "distributed/shardinterval_utils.h" #include "distributed/worker_protocol.h" #include "distributed/worker_transaction.h" +#include "storage/lmgr.h" #include "utils/builtins.h" #include "utils/fmgroids.h" #include "utils/lsyscache.h" @@ -929,6 +930,9 @@ ColocatedShardIntervalList(ShardInterval *shardInterval) /* * ColocatedTableId returns an arbitrary table which belongs to given colocation * group. If there is not such a colocation group, it returns invalid oid. + * + * This function also takes an AccessShareLock on the co-colocated table to + * guarantee that the table isn't dropped for the remainder of the transaction. */ Oid ColocatedTableId(Oid colocationId) @@ -955,7 +959,7 @@ ColocatedTableId(Oid colocationId) ScanKeyInit(&scanKey[0], Anum_pg_dist_partition_colocationid, BTEqualStrategyNumber, F_INT4EQ, ObjectIdGetDatum(colocationId)); - /* prevent DELETE statements */ + /* do not allow any tables to be dropped while we read from pg_dist_partition */ pgDistPartition = heap_open(DistPartitionRelationId(), ShareLock); tupleDescriptor = RelationGetDescr(pgDistPartition); scanDescriptor = systable_beginscan(pgDistPartition, @@ -967,6 +971,9 @@ ColocatedTableId(Oid colocationId) { colocatedTableId = heap_getattr(heapTuple, Anum_pg_dist_partition_logicalrelid, tupleDescriptor, &isNull); + + /* make sure the table isn't dropped for the remainder of the transaction */ + LockRelationOid(colocatedTableId, AccessShareLock); } systable_endscan(scanDescriptor); diff --git a/src/test/regress/expected/multi_colocation_utils.out b/src/test/regress/expected/multi_colocation_utils.out index d43250d06..383554b86 100644 --- a/src/test/regress/expected/multi_colocation_utils.out +++ b/src/test/regress/expected/multi_colocation_utils.out @@ -432,11 +432,12 @@ SELECT * FROM pg_dist_colocation ORDER BY colocationid; colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ + 3 | 32 | 2 | 23 4 | 2 | 2 | 23 5 | 2 | 1 | 23 6 | 2 | 2 | 25 7 | 4 | 2 | 23 -(4 rows) +(5 rows) SELECT logicalrelid, colocationid FROM pg_dist_partition WHERE colocationid >= 1 AND colocationid < 1000 @@ -467,7 +468,8 @@ DROP TABLE table2_groupA; SELECT * FROM pg_dist_colocation WHERE colocationid = 4; colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ -(0 rows) + 4 | 2 | 2 | 23 +(1 row) -- create dropped colocation group again SET citus.shard_count = 2; @@ -554,18 +556,24 @@ SELECT * FROM pg_dist_colocation ORDER BY colocationid; colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ + 3 | 32 | 2 | 23 + 4 | 2 | 2 | 23 5 | 2 | 1 | 23 6 | 2 | 2 | 25 7 | 4 | 2 | 23 - 8 | 2 | 2 | 23 - 12 | 3 | 2 | 23 -(5 rows) + 11 | 3 | 2 | 23 +(6 rows) SELECT logicalrelid, colocationid FROM pg_dist_partition WHERE colocationid >= 1 AND colocationid < 1000 ORDER BY colocationid, logicalrelid; logicalrelid | colocationid ----------------------------------+-------------- + table1_groupe | 4 + table2_groupe | 4 + table3_groupe | 4 + schema_collocation.table4_groupe | 4 + table4_groupe | 4 table1_groupb | 5 table2_groupb | 5 table1_groupc | 6 @@ -573,16 +581,11 @@ SELECT logicalrelid, colocationid FROM pg_dist_partition table1_groupd | 7 table2_groupd | 7 table3_groupd | 7 - table1_groupe | 8 - table2_groupe | 8 - table3_groupe | 8 - schema_collocation.table4_groupe | 8 - table4_groupe | 8 - table1_group_none_1 | 9 - table2_group_none_1 | 9 - table1_group_none_2 | 10 - table1_group_none_3 | 11 - table1_group_default | 12 + table1_group_none_1 | 8 + table2_group_none_1 | 8 + table1_group_none_2 | 9 + table1_group_none_3 | 10 + table1_group_default | 11 (17 rows) -- check failing colocate_with options @@ -647,12 +650,12 @@ SELECT * FROM pg_dist_colocation ORDER BY colocationid; colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ + 3 | 32 | 2 | 23 + 4 | 2 | 2 | 23 5 | 2 | 1 | 23 6 | 2 | 2 | 25 7 | 4 | 2 | 23 - 8 | 2 | 2 | 23 - 12 | 3 | 2 | 23 - 13 | 1 | 2 | 0 + 11 | 3 | 2 | 23 (6 rows) -- cross check with internal colocation API @@ -915,8 +918,7 @@ SELECT * FROM pg_dist_colocation 3 | 2 | 2 | 25 4 | 4 | 2 | 23 5 | 2 | 2 | 23 - 6 | 1 | 2 | 0 -(5 rows) +(4 rows) SELECT logicalrelid, colocationid FROM pg_dist_partition WHERE colocationid >= 1 AND colocationid < 1000 @@ -932,11 +934,9 @@ SELECT logicalrelid, colocationid FROM pg_dist_partition table1_groupe | 5 table2_groupe | 5 table3_groupe | 5 - table1_groupf | 6 - table2_groupf | 6 - table1_group_none | 7 - table2_group_none | 8 -(13 rows) + table1_group_none | 6 + table2_group_none | 7 +(11 rows) -- move the all tables in colocation group 5 to colocation group 7 SELECT mark_tables_colocated('table1_group_none', ARRAY['table1_groupE', 'table2_groupE', 'table3_groupE']); @@ -961,8 +961,7 @@ SELECT * FROM pg_dist_colocation 2 | 2 | 1 | 23 3 | 2 | 2 | 25 4 | 4 | 2 | 23 - 6 | 1 | 2 | 0 -(4 rows) +(3 rows) SELECT logicalrelid, colocationid FROM pg_dist_partition WHERE colocationid >= 1 AND colocationid < 1000 @@ -975,14 +974,12 @@ SELECT logicalrelid, colocationid FROM pg_dist_partition table2_groupc | 3 table1_groupd | 4 table2_groupd | 4 - table1_groupf | 6 - table2_groupf | 6 - table1_groupe | 7 - table2_groupe | 7 - table3_groupe | 7 - table1_group_none | 7 - table2_group_none | 7 -(13 rows) + table1_groupe | 6 + table2_groupe | 6 + table3_groupe | 6 + table1_group_none | 6 + table2_group_none | 6 +(11 rows) -- try to colocate different replication models CREATE TABLE table1_groupG ( id int ); diff --git a/src/test/regress/expected/multi_extension.out b/src/test/regress/expected/multi_extension.out index f861eea78..140b3fd2b 100644 --- a/src/test/regress/expected/multi_extension.out +++ b/src/test/regress/expected/multi_extension.out @@ -122,6 +122,7 @@ ALTER EXTENSION citus UPDATE TO '7.0-9'; ALTER EXTENSION citus UPDATE TO '7.0-10'; ALTER EXTENSION citus UPDATE TO '7.0-11'; ALTER EXTENSION citus UPDATE TO '7.0-12'; +ALTER EXTENSION citus UPDATE TO '7.0-13'; -- show running version SHOW citus.version; citus.version 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 bb256f48b..485968b33 100644 --- a/src/test/regress/expected/multi_remove_node_reference_table.out +++ b/src/test/regress/expected/multi_remove_node_reference_table.out @@ -141,7 +141,7 @@ WHERE colocationid IN WHERE logicalrelid = 'remove_node_reference_table'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1380000 | 1 | 2 | 0 + 1370005 | 1 | 2 | 0 (1 row) @@ -196,7 +196,7 @@ WHERE colocationid IN WHERE logicalrelid = 'remove_node_reference_table'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1380000 | 1 | 1 | 0 + 1370005 | 1 | 1 | 0 (1 row) \c - - - :worker_1_port @@ -277,7 +277,7 @@ WHERE colocationid IN WHERE logicalrelid = 'remove_node_reference_table'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1380000 | 1 | 2 | 0 + 1370005 | 1 | 2 | 0 (1 row) @@ -335,7 +335,7 @@ WHERE colocationid IN WHERE logicalrelid = 'remove_node_reference_table'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1380000 | 1 | 2 | 0 + 1370005 | 1 | 2 | 0 (1 row) \c - - - :worker_1_port @@ -385,7 +385,7 @@ WHERE colocationid IN WHERE logicalrelid = 'remove_node_reference_table'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1380000 | 1 | 2 | 0 + 1370005 | 1 | 2 | 0 (1 row) @@ -442,7 +442,7 @@ WHERE colocationid IN WHERE logicalrelid = 'remove_node_reference_table'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1380000 | 1 | 1 | 0 + 1370005 | 1 | 1 | 0 (1 row) @@ -500,7 +500,7 @@ WHERE colocationid IN WHERE logicalrelid = 'remove_node_reference_table'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1380000 | 1 | 2 | 0 + 1370005 | 1 | 2 | 0 (1 row) \c - - - :worker_1_port @@ -558,7 +558,7 @@ WHERE colocationid IN WHERE logicalrelid = 'remove_node_reference_table'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1380000 | 1 | 1 | 0 + 1370005 | 1 | 1 | 0 (1 row) --verify the data is inserted @@ -629,7 +629,7 @@ WHERE colocationid IN WHERE logicalrelid = 'remove_node_reference_table'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1380000 | 1 | 2 | 0 + 1370005 | 1 | 2 | 0 (1 row) \c - - - :worker_1_port @@ -688,7 +688,7 @@ WHERE colocationid IN WHERE logicalrelid = 'remove_node_reference_table'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1380000 | 1 | 1 | 0 + 1370005 | 1 | 1 | 0 (1 row) @@ -754,7 +754,7 @@ WHERE colocationid IN WHERE logicalrelid = 'remove_node_reference_table'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1380000 | 1 | 2 | 0 + 1370005 | 1 | 2 | 0 (1 row) BEGIN; @@ -841,7 +841,7 @@ WHERE colocationid IN WHERE logicalrelid = 'remove_node_reference_table_schema.table1'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1380001 | 1 | 2 | 0 + 1370004 | 1 | 2 | 0 (1 row) @@ -898,7 +898,7 @@ WHERE colocationid IN WHERE logicalrelid = 'remove_node_reference_table_schema.table1'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1380001 | 1 | 1 | 0 + 1370004 | 1 | 1 | 0 (1 row) \c - - - :worker_1_port @@ -960,7 +960,7 @@ WHERE colocationid IN WHERE logicalrelid = 'remove_node_reference_table'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1380001 | 1 | 2 | 0 + 1370004 | 1 | 2 | 0 (1 row) \c - - - :worker_1_port @@ -1017,7 +1017,7 @@ WHERE colocationid IN WHERE logicalrelid = 'remove_node_reference_table'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1380001 | 1 | 2 | 0 + 1370004 | 1 | 2 | 0 (1 row) \c - - - :worker_1_port diff --git a/src/test/regress/expected/multi_replicate_reference_table.out b/src/test/regress/expected/multi_replicate_reference_table.out index 158db8ce0..184c1885e 100644 --- a/src/test/regress/expected/multi_replicate_reference_table.out +++ b/src/test/regress/expected/multi_replicate_reference_table.out @@ -117,7 +117,7 @@ WHERE colocationid IN WHERE logicalrelid = 'replicate_reference_table_valid'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1370001 | 1 | 1 | 0 + 1370000 | 1 | 1 | 0 (1 row) SELECT 1 FROM master_add_node('localhost', :worker_2_port); @@ -147,7 +147,7 @@ WHERE colocationid IN WHERE logicalrelid = 'replicate_reference_table_valid'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1370001 | 1 | 2 | 0 + 1370000 | 1 | 2 | 0 (1 row) -- test add same node twice @@ -171,7 +171,7 @@ WHERE colocationid IN WHERE logicalrelid = 'replicate_reference_table_valid'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1370001 | 1 | 2 | 0 + 1370000 | 1 | 2 | 0 (1 row) SELECT 1 FROM master_add_node('localhost', :worker_2_port); @@ -200,7 +200,7 @@ WHERE colocationid IN WHERE logicalrelid = 'replicate_reference_table_valid'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1370001 | 1 | 2 | 0 + 1370000 | 1 | 2 | 0 (1 row) DROP TABLE replicate_reference_table_valid; @@ -237,7 +237,7 @@ WHERE colocationid IN WHERE logicalrelid = 'replicate_reference_table_rollback'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1370002 | 1 | 1 | 0 + 1370001 | 1 | 1 | 0 (1 row) BEGIN; @@ -268,7 +268,7 @@ WHERE colocationid IN WHERE logicalrelid = 'replicate_reference_table_rollback'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1370002 | 1 | 1 | 0 + 1370001 | 1 | 1 | 0 (1 row) DROP TABLE replicate_reference_table_rollback; @@ -299,7 +299,7 @@ WHERE colocationid IN WHERE logicalrelid = 'replicate_reference_table_commit'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1370003 | 1 | 1 | 0 + 1370001 | 1 | 1 | 0 (1 row) BEGIN; @@ -331,7 +331,7 @@ WHERE colocationid IN WHERE logicalrelid = 'replicate_reference_table_commit'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1370003 | 1 | 2 | 0 + 1370001 | 1 | 2 | 0 (1 row) DROP TABLE replicate_reference_table_commit; @@ -381,7 +381,7 @@ WHERE colocationid IN WHERE logicalrelid = 'replicate_reference_table_reference_one'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1370004 | 1 | 1 | 0 + 1370002 | 1 | 1 | 0 (1 row) SELECT @@ -393,8 +393,8 @@ WHERE ORDER BY logicalrelid; logicalrelid | partmethod | colocationid | repmodel -----------------------------------------+------------+--------------+---------- - replicate_reference_table_reference_one | n | 1370004 | t - replicate_reference_table_hash | h | 1370005 | c + replicate_reference_table_reference_one | n | 1370002 | t + replicate_reference_table_hash | h | 1360004 | c (2 rows) BEGIN; @@ -443,7 +443,7 @@ WHERE colocationid IN WHERE logicalrelid = 'replicate_reference_table_reference_one'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1370004 | 1 | 2 | 0 + 1370002 | 1 | 2 | 0 (1 row) SELECT @@ -456,9 +456,9 @@ ORDER BY logicalrelid; logicalrelid | partmethod | colocationid | repmodel -----------------------------------------+------------+--------------+---------- - replicate_reference_table_reference_one | n | 1370004 | t - replicate_reference_table_hash | n | 1370004 | t - replicate_reference_table_reference_two | n | 1370004 | t + replicate_reference_table_reference_one | n | 1370002 | t + replicate_reference_table_hash | n | 1370002 | t + replicate_reference_table_reference_two | n | 1370002 | t (3 rows) DROP TABLE replicate_reference_table_reference_one; @@ -544,7 +544,7 @@ WHERE colocationid IN WHERE logicalrelid = 'replicate_reference_table_drop'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1370009 | 1 | 1 | 0 + 1370003 | 1 | 1 | 0 (1 row) BEGIN; @@ -607,7 +607,7 @@ WHERE colocationid IN WHERE logicalrelid = 'replicate_reference_table_schema.table1'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1370010 | 1 | 1 | 0 + 1370004 | 1 | 1 | 0 (1 row) SELECT 1 FROM master_add_node('localhost', :worker_2_port); @@ -637,7 +637,7 @@ WHERE colocationid IN WHERE logicalrelid = 'replicate_reference_table_schema.table1'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1370010 | 1 | 2 | 0 + 1370004 | 1 | 2 | 0 (1 row) DROP TABLE replicate_reference_table_schema.table1; diff --git a/src/test/regress/expected/multi_upgrade_reference_table.out b/src/test/regress/expected/multi_upgrade_reference_table.out index f50284088..6a0ceabdd 100644 --- a/src/test/regress/expected/multi_upgrade_reference_table.out +++ b/src/test/regress/expected/multi_upgrade_reference_table.out @@ -180,7 +180,7 @@ WHERE logicalrelid = 'upgrade_reference_table_append'::regclass; partmethod | partkeyisnull | colocationid | repmodel ------------+---------------+--------------+---------- - n | t | 1360005 | t + n | t | 10005 | t (1 row) SELECT @@ -202,7 +202,7 @@ WHERE colocationid IN WHERE logicalrelid = 'upgrade_reference_table_append'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1360005 | 1 | 2 | 0 + 10005 | 1 | 2 | 0 (1 row) SELECT @@ -240,7 +240,7 @@ WHERE logicalrelid = 'upgrade_reference_table_one_worker'::regclass; partmethod | partkeyisnull | colocationid | repmodel ------------+---------------+--------------+---------- - h | f | 1360006 | c + h | f | 1360000 | c (1 row) SELECT @@ -262,7 +262,7 @@ WHERE colocationid IN WHERE logicalrelid = 'upgrade_reference_table_one_worker'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1360006 | 1 | 1 | 23 + 1360000 | 1 | 1 | 23 (1 row) SELECT @@ -293,7 +293,7 @@ WHERE logicalrelid = 'upgrade_reference_table_one_worker'::regclass; partmethod | partkeyisnull | colocationid | repmodel ------------+---------------+--------------+---------- - n | t | 1360007 | t + n | t | 10005 | t (1 row) SELECT @@ -315,7 +315,7 @@ WHERE colocationid IN WHERE logicalrelid = 'upgrade_reference_table_one_worker'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1360007 | 1 | 2 | 0 + 10005 | 1 | 2 | 0 (1 row) SELECT @@ -354,7 +354,7 @@ WHERE logicalrelid = 'upgrade_reference_table_one_unhealthy'::regclass; partmethod | partkeyisnull | colocationid | repmodel ------------+---------------+--------------+---------- - h | f | 1360008 | c + h | f | 1360001 | c (1 row) SELECT @@ -376,7 +376,7 @@ WHERE colocationid IN WHERE logicalrelid = 'upgrade_reference_table_one_unhealthy'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1360008 | 1 | 2 | 23 + 1360001 | 1 | 2 | 23 (1 row) SELECT @@ -409,7 +409,7 @@ WHERE logicalrelid = 'upgrade_reference_table_one_unhealthy'::regclass; partmethod | partkeyisnull | colocationid | repmodel ------------+---------------+--------------+---------- - n | t | 1360009 | t + n | t | 10005 | t (1 row) SELECT @@ -431,7 +431,7 @@ WHERE colocationid IN WHERE logicalrelid = 'upgrade_reference_table_one_unhealthy'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1360009 | 1 | 2 | 0 + 10005 | 1 | 2 | 0 (1 row) SELECT @@ -468,7 +468,7 @@ WHERE logicalrelid = 'upgrade_reference_table_both_healthy'::regclass; partmethod | partkeyisnull | colocationid | repmodel ------------+---------------+--------------+---------- - h | f | 1360010 | c + h | f | 1360002 | c (1 row) SELECT @@ -490,7 +490,7 @@ WHERE colocationid IN WHERE logicalrelid = 'upgrade_reference_table_both_healthy'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1360010 | 1 | 2 | 23 + 1360002 | 1 | 2 | 23 (1 row) SELECT @@ -523,7 +523,7 @@ WHERE logicalrelid = 'upgrade_reference_table_both_healthy'::regclass; partmethod | partkeyisnull | colocationid | repmodel ------------+---------------+--------------+---------- - n | t | 1360011 | t + n | t | 10005 | t (1 row) SELECT @@ -545,7 +545,7 @@ WHERE colocationid IN WHERE logicalrelid = 'upgrade_reference_table_both_healthy'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1360011 | 1 | 2 | 0 + 10005 | 1 | 2 | 0 (1 row) SELECT @@ -584,7 +584,7 @@ WHERE logicalrelid = 'upgrade_reference_table_transaction_rollback'::regclass; partmethod | partkeyisnull | colocationid | repmodel ------------+---------------+--------------+---------- - h | f | 1360012 | c + h | f | 1360003 | c (1 row) SELECT @@ -606,7 +606,7 @@ WHERE colocationid IN WHERE logicalrelid = 'upgrade_reference_table_transaction_rollback'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1360012 | 1 | 1 | 23 + 1360003 | 1 | 1 | 23 (1 row) SELECT @@ -639,7 +639,7 @@ WHERE logicalrelid = 'upgrade_reference_table_transaction_rollback'::regclass; partmethod | partkeyisnull | colocationid | repmodel ------------+---------------+--------------+---------- - h | f | 1360012 | c + h | f | 1360003 | c (1 row) SELECT @@ -661,7 +661,7 @@ WHERE colocationid IN WHERE logicalrelid = 'upgrade_reference_table_transaction_rollback'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1360012 | 1 | 1 | 23 + 1360003 | 1 | 1 | 23 (1 row) SELECT @@ -697,7 +697,7 @@ WHERE logicalrelid = 'upgrade_reference_table_transaction_commit'::regclass; partmethod | partkeyisnull | colocationid | repmodel ------------+---------------+--------------+---------- - h | f | 1360014 | c + h | f | 1360003 | c (1 row) SELECT @@ -719,7 +719,7 @@ WHERE colocationid IN WHERE logicalrelid = 'upgrade_reference_table_transaction_commit'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1360014 | 1 | 1 | 23 + 1360003 | 1 | 1 | 23 (1 row) SELECT @@ -752,7 +752,7 @@ WHERE logicalrelid = 'upgrade_reference_table_transaction_commit'::regclass; partmethod | partkeyisnull | colocationid | repmodel ------------+---------------+--------------+---------- - n | t | 1360015 | t + n | t | 10005 | t (1 row) SELECT @@ -774,7 +774,7 @@ WHERE colocationid IN WHERE logicalrelid = 'upgrade_reference_table_transaction_commit'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1360015 | 1 | 2 | 0 + 10005 | 1 | 2 | 0 (1 row) SELECT @@ -823,7 +823,7 @@ WHERE logicalrelid = 'upgrade_reference_table_mx'::regclass; partmethod | partkeyisnull | colocationid | repmodel ------------+---------------+--------------+---------- - h | f | 1360016 | s + h | f | 1360004 | s (1 row) SELECT @@ -845,7 +845,7 @@ WHERE colocationid IN WHERE logicalrelid = 'upgrade_reference_table_mx'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1360016 | 1 | 1 | 23 + 1360004 | 1 | 1 | 23 (1 row) SELECT @@ -875,7 +875,7 @@ WHERE logicalrelid = 'upgrade_reference_table_mx'::regclass; partmethod | partkeyisnull | colocationid | repmodel ------------+---------------+--------------+---------- - h | f | 1360016 | s + h | f | 1360004 | s (1 row) SELECT @@ -897,7 +897,7 @@ WHERE colocationid IN WHERE logicalrelid = 'upgrade_reference_table_mx'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1360016 | 1 | 1 | 23 + 1360004 | 1 | 1 | 23 (1 row) SELECT @@ -944,7 +944,7 @@ WHERE logicalrelid = 'upgrade_reference_table_mx'::regclass; partmethod | partkeyisnull | colocationid | repmodel ------------+---------------+--------------+---------- - h | f | 1360017 | c + h | f | 1360005 | c (1 row) SELECT @@ -966,7 +966,7 @@ WHERE colocationid IN WHERE logicalrelid = 'upgrade_reference_table_mx'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1360017 | 1 | 2 | 23 + 1360005 | 1 | 2 | 23 (1 row) SELECT @@ -1001,7 +1001,7 @@ WHERE logicalrelid = 'upgrade_reference_table_mx'::regclass; partmethod | partkeyisnull | colocationid | repmodel ------------+---------------+--------------+---------- - n | t | 1360018 | t + n | t | 10005 | t (1 row) SELECT @@ -1023,7 +1023,7 @@ WHERE colocationid IN WHERE logicalrelid = 'upgrade_reference_table_mx'::regclass); colocationid | shardcount | replicationfactor | distributioncolumntype --------------+------------+-------------------+------------------------ - 1360018 | 1 | 2 | 0 + 10005 | 1 | 2 | 0 (1 row) SELECT @@ -1051,7 +1051,7 @@ WHERE logicalrelid = 'upgrade_reference_table_mx'::regclass; partmethod | partkeyisnull | colocationid | repmodel ------------+---------------+--------------+---------- - n | t | 1360018 | t + n | t | 10005 | t (1 row) SELECT diff --git a/src/test/regress/sql/multi_extension.sql b/src/test/regress/sql/multi_extension.sql index 027152af6..d748f6c8d 100644 --- a/src/test/regress/sql/multi_extension.sql +++ b/src/test/regress/sql/multi_extension.sql @@ -122,6 +122,7 @@ ALTER EXTENSION citus UPDATE TO '7.0-9'; ALTER EXTENSION citus UPDATE TO '7.0-10'; ALTER EXTENSION citus UPDATE TO '7.0-11'; ALTER EXTENSION citus UPDATE TO '7.0-12'; +ALTER EXTENSION citus UPDATE TO '7.0-13'; -- show running version SHOW citus.version;