diff --git a/src/backend/distributed/commands/citus_add_local_table_to_metadata.c b/src/backend/distributed/commands/citus_add_local_table_to_metadata.c index da43cd3ba..f38a0acb3 100644 --- a/src/backend/distributed/commands/citus_add_local_table_to_metadata.c +++ b/src/backend/distributed/commands/citus_add_local_table_to_metadata.c @@ -1456,9 +1456,9 @@ InsertMetadataForCitusLocalTable(Oid citusLocalTableId, uint64 shardId, text *shardMinValue = NULL; text *shardMaxValue = NULL; - bool needsIsolatedNode = false; + bool needsSeparateNode = false; InsertShardRow(citusLocalTableId, shardId, shardStorageType, - shardMinValue, shardMaxValue, needsIsolatedNode); + shardMinValue, shardMaxValue, needsSeparateNode); List *nodeList = list_make1(CoordinatorNodeIfAddedAsWorkerOrError()); diff --git a/src/backend/distributed/commands/create_distributed_table.c b/src/backend/distributed/commands/create_distributed_table.c index 5874f998d..57397fea7 100644 --- a/src/backend/distributed/commands/create_distributed_table.c +++ b/src/backend/distributed/commands/create_distributed_table.c @@ -134,7 +134,7 @@ static char DecideDistTableReplicationModel(char distributionMethod, static List * HashSplitPointsForShardList(List *shardList); static List * HashSplitPointsForShardCount(int shardCount); static List * WorkerNodesForShardList(List *shardList); -static List * NeedsIsolatedNodeForShardList(List *shardList); +static List * NeedsSeparateNodeForShardList(List *shardList); static List * RoundRobinWorkerNodeList(List *workerNodeList, int listLength); static CitusTableParams DecideCitusTableParams(CitusTableType tableType, DistributedTableParams * @@ -574,7 +574,7 @@ CreateDistributedTableConcurrently(Oid relationId, char *distributionColumnName, List *workersForPlacementList; List *shardSplitPointsList; - List *needsIsolatedNodeForPlacementList; + List *needsSeparateNodeForPlacementList; if (colocatedTableId != InvalidOid) @@ -592,10 +592,10 @@ CreateDistributedTableConcurrently(Oid relationId, char *distributionColumnName, workersForPlacementList = WorkerNodesForShardList(colocatedShardList); /* - * Inherit needsisolatednode from the colocated shards. + * Inherit needsseparatenode from the colocated shards. */ - needsIsolatedNodeForPlacementList = - NeedsIsolatedNodeForShardList(colocatedShardList); + needsSeparateNodeForPlacementList = + NeedsSeparateNodeForShardList(colocatedShardList); } else { @@ -618,10 +618,10 @@ CreateDistributedTableConcurrently(Oid relationId, char *distributionColumnName, workersForPlacementList = RoundRobinWorkerNodeList(workerNodeList, shardCount); /* - * For a new colocation group, needsisolatednode is set to false for + * For a new colocation group, needsseparatenode is set to false for * all shards. */ - needsIsolatedNodeForPlacementList = GenerateListFromIntElement(false, shardCount); + needsSeparateNodeForPlacementList = GenerateListFromIntElement(false, shardCount); } /* @@ -660,7 +660,7 @@ CreateDistributedTableConcurrently(Oid relationId, char *distributionColumnName, shardToSplit->shardId, shardSplitPointsList, workersForPlacementList, - needsIsolatedNodeForPlacementList, + needsSeparateNodeForPlacementList, distributionColumnOverrides, sourceColocatedShardIntervalList, colocationId @@ -914,22 +914,22 @@ WorkerNodesForShardList(List *shardList) /* - * NeedsIsolatedNodeForShardList returns a list of node booleans reflecting whether - * each shard in the given list needs an isolated node. + * NeedsSeparateNodeForShardList returns a list of node booleans reflecting whether + * each shard in the given list needs a separate node. */ static List * -NeedsIsolatedNodeForShardList(List *shardList) +NeedsSeparateNodeForShardList(List *shardList) { - List *needsIsolatedNodeList = NIL; + List *needsSeparateNodeList = NIL; ShardInterval *shardInterval = NULL; foreach_ptr(shardInterval, shardList) { - needsIsolatedNodeList = lappend_int(needsIsolatedNodeList, - shardInterval->needsIsolatedNode); + needsSeparateNodeList = lappend_int(needsSeparateNodeList, + shardInterval->needsSeparateNode); } - return needsIsolatedNodeList; + return needsSeparateNodeList; } diff --git a/src/backend/distributed/metadata/metadata_cache.c b/src/backend/distributed/metadata/metadata_cache.c index 1d68861aa..51db21f86 100644 --- a/src/backend/distributed/metadata/metadata_cache.c +++ b/src/backend/distributed/metadata/metadata_cache.c @@ -5379,8 +5379,8 @@ DeformedDistShardTupleToShardInterval(Datum *datumArray, bool *isNullArray, char storageType = DatumGetChar(datumArray[Anum_pg_dist_shard_shardstorage - 1]); Datum minValueTextDatum = datumArray[Anum_pg_dist_shard_shardminvalue - 1]; Datum maxValueTextDatum = datumArray[Anum_pg_dist_shard_shardmaxvalue - 1]; - bool needsIsolatedNode = DatumGetBool( - datumArray[Anum_pg_dist_shard_needsisolatednode - 1]); + bool needsSeparateNode = DatumGetBool( + datumArray[Anum_pg_dist_shard_needsseparatenode - 1]); bool minValueNull = isNullArray[Anum_pg_dist_shard_shardminvalue - 1]; bool maxValueNull = isNullArray[Anum_pg_dist_shard_shardmaxvalue - 1]; @@ -5417,7 +5417,7 @@ DeformedDistShardTupleToShardInterval(Datum *datumArray, bool *isNullArray, shardInterval->minValue = minValue; shardInterval->maxValue = maxValue; shardInterval->shardId = shardId; - shardInterval->needsIsolatedNode = needsIsolatedNode; + shardInterval->needsSeparateNode = needsSeparateNode; return shardInterval; } diff --git a/src/backend/distributed/metadata/metadata_sync.c b/src/backend/distributed/metadata/metadata_sync.c index fd7c4d57e..232b3ab35 100644 --- a/src/backend/distributed/metadata/metadata_sync.c +++ b/src/backend/distributed/metadata/metadata_sync.c @@ -96,7 +96,7 @@ int MetadataSyncTransMode = METADATA_SYNC_TRANSACTIONAL; static Datum citus_internal_add_shard_metadata_internal(PG_FUNCTION_ARGS, - bool expectNeedsIsolatedNode); + bool expectNeedsSeparateNode); static void EnsureObjectMetadataIsSane(int distributionArgumentIndex, int colocationId); static List * GetFunctionDependenciesForObjects(ObjectAddress *objectAddress); @@ -182,7 +182,7 @@ PG_FUNCTION_INFO_V1(citus_internal_delete_colocation_metadata); PG_FUNCTION_INFO_V1(citus_internal_add_tenant_schema); PG_FUNCTION_INFO_V1(citus_internal_delete_tenant_schema); PG_FUNCTION_INFO_V1(citus_internal_update_none_dist_table_metadata); -PG_FUNCTION_INFO_V1(citus_internal_shard_group_set_needsisolatednode); +PG_FUNCTION_INFO_V1(citus_internal_shard_group_set_needsseparatenode); static bool got_SIGTERM = false; @@ -1248,7 +1248,7 @@ ShardListInsertCommand(List *shardIntervalList) StringInfo insertShardCommand = makeStringInfo(); appendStringInfo(insertShardCommand, "WITH shard_data(relationname, shardid, storagetype, " - "shardminvalue, shardmaxvalue, needsisolatednode) AS (VALUES "); + "shardminvalue, shardmaxvalue, needsseparatenode) AS (VALUES "); foreach_ptr(shardInterval, shardIntervalList) { @@ -1286,7 +1286,7 @@ ShardListInsertCommand(List *shardIntervalList) shardInterval->storageType, minHashToken->data, maxHashToken->data, - shardInterval->needsIsolatedNode ? "true" : "false"); + shardInterval->needsSeparateNode ? "true" : "false"); if (llast(shardIntervalList) != shardInterval) { @@ -1298,7 +1298,7 @@ ShardListInsertCommand(List *shardIntervalList) appendStringInfo(insertShardCommand, "SELECT citus_internal_add_shard_metadata(relationname, shardid, " - "storagetype, shardminvalue, shardmaxvalue, needsisolatednode) " + "storagetype, shardminvalue, shardmaxvalue, needsseparatenode) " "FROM shard_data;"); /* @@ -3227,21 +3227,21 @@ citus_internal_delete_partition_metadata(PG_FUNCTION_ARGS) Datum citus_internal_add_shard_metadata(PG_FUNCTION_ARGS) { - bool expectNeedsIsolatedNode = true; - return citus_internal_add_shard_metadata_internal(fcinfo, expectNeedsIsolatedNode); + bool expectNeedsSeparateNode = true; + return citus_internal_add_shard_metadata_internal(fcinfo, expectNeedsSeparateNode); } /* * citus_internal_add_shard_metadata is an internal UDF to - * add a row to pg_dist_shard, but without the needs_isolated_node + * add a row to pg_dist_shard, but without the needs_separate_node * parameter. */ Datum citus_internal_add_shard_metadata_legacy(PG_FUNCTION_ARGS) { - bool expectNeedsIsolatedNode = false; - return citus_internal_add_shard_metadata_internal(fcinfo, expectNeedsIsolatedNode); + bool expectNeedsSeparateNode = false; + return citus_internal_add_shard_metadata_internal(fcinfo, expectNeedsSeparateNode); } @@ -3252,7 +3252,7 @@ citus_internal_add_shard_metadata_legacy(PG_FUNCTION_ARGS) */ static Datum citus_internal_add_shard_metadata_internal(PG_FUNCTION_ARGS, - bool expectNeedsIsolatedNode) + bool expectNeedsSeparateNode) { CheckCitusVersion(ERROR); @@ -3277,11 +3277,11 @@ citus_internal_add_shard_metadata_internal(PG_FUNCTION_ARGS, shardMaxValue = PG_GETARG_TEXT_P(4); } - bool needsIsolatedNode = false; - if (expectNeedsIsolatedNode) + bool needsSeparateNode = false; + if (expectNeedsSeparateNode) { - PG_ENSURE_ARGNOTNULL(5, "needs isolated node"); - needsIsolatedNode = PG_GETARG_BOOL(5); + PG_ENSURE_ARGNOTNULL(5, "needs separate node"); + needsSeparateNode = PG_GETARG_BOOL(5); } /* only owner of the table (or superuser) is allowed to add the Citus metadata */ @@ -3305,7 +3305,7 @@ citus_internal_add_shard_metadata_internal(PG_FUNCTION_ARGS, } InsertShardRow(relationId, shardId, storageType, shardMinValue, shardMaxValue, - needsIsolatedNode); + needsSeparateNode); PG_RETURN_VOID(); } @@ -3936,12 +3936,12 @@ citus_internal_update_none_dist_table_metadata(PG_FUNCTION_ARGS) /* - * citus_internal_shard_group_set_needsisolatednode is an internal UDF to - * set needsisolatednode flag for all the shards within the shard group + * citus_internal_shard_group_set_needsseparatenode is an internal UDF to + * set needsseparatenode flag for all the shards within the shard group * that given shard belongs to. */ Datum -citus_internal_shard_group_set_needsisolatednode(PG_FUNCTION_ARGS) +citus_internal_shard_group_set_needsseparatenode(PG_FUNCTION_ARGS) { CheckCitusVersion(ERROR); @@ -3963,7 +3963,7 @@ citus_internal_shard_group_set_needsisolatednode(PG_FUNCTION_ARGS) EnsureCoordinatorInitiatedOperation(); } - ShardGroupSetNeedsIsolatedNode(shardId, enabled); + ShardGroupSetNeedsSeparateNode(shardId, enabled); PG_RETURN_VOID(); } @@ -4169,15 +4169,15 @@ UpdateNoneDistTableMetadataCommand(Oid relationId, char replicationModel, /* - * ShardGroupSetNeedsIsolatedNodeCommand returns a command to call - * citus_internal_shard_group_set_needsisolatednode(). + * ShardGroupSetNeedsSeparateNodeCommand returns a command to call + * citus_internal_shard_group_set_needsseparatenode(). */ char * -ShardGroupSetNeedsIsolatedNodeCommand(uint64 shardId, bool enabled) +ShardGroupSetNeedsSeparateNodeCommand(uint64 shardId, bool enabled) { StringInfo command = makeStringInfo(); appendStringInfo(command, - "SELECT pg_catalog.citus_internal_shard_group_set_needsisolatednode(%lu, %s)", + "SELECT pg_catalog.citus_internal_shard_group_set_needsseparatenode(%lu, %s)", shardId, enabled ? "true" : "false"); return command->data; diff --git a/src/backend/distributed/metadata/metadata_utility.c b/src/backend/distributed/metadata/metadata_utility.c index 5f48bbd4a..f1758c2d1 100644 --- a/src/backend/distributed/metadata/metadata_utility.c +++ b/src/backend/distributed/metadata/metadata_utility.c @@ -116,8 +116,8 @@ static HeapTuple CreateDiskSpaceTuple(TupleDesc tupleDesc, uint64 availableBytes uint64 totalBytes); static bool GetLocalDiskSpaceStats(uint64 *availableBytes, uint64 *totalBytes); static void citus_shard_property_set_anti_affinity(uint64 shardId, bool enabled); -static void ShardGroupSetNeedsIsolatedNodeGlobally(uint64 shardId, bool enabled); -static void ShardSetNeedsIsolatedNode(uint64 shardId, bool enabled); +static void ShardGroupSetNeedsSeparateNodeGlobally(uint64 shardId, bool enabled); +static void ShardSetNeedsSeparateNode(uint64 shardId, bool enabled); static BackgroundTask * DeformBackgroundTaskHeapTuple(TupleDesc tupleDescriptor, HeapTuple taskTuple); @@ -417,32 +417,32 @@ citus_shard_property_set_anti_affinity(uint64 shardId, bool enabled) "distributed tables"))); } - ShardGroupSetNeedsIsolatedNodeGlobally(shardId, enabled); + ShardGroupSetNeedsSeparateNodeGlobally(shardId, enabled); } /* - * ShardGroupSetNeedsIsolatedNodeGlobally calls ShardGroupSetNeedsIsolatedNode + * ShardGroupSetNeedsSeparateNodeGlobally calls ShardGroupSetNeedsSeparateNode * on all nodes. */ static void -ShardGroupSetNeedsIsolatedNodeGlobally(uint64 shardId, bool enabled) +ShardGroupSetNeedsSeparateNodeGlobally(uint64 shardId, bool enabled) { - ShardGroupSetNeedsIsolatedNode(shardId, enabled); + ShardGroupSetNeedsSeparateNode(shardId, enabled); char *metadataCommand = - ShardGroupSetNeedsIsolatedNodeCommand(shardId, enabled); + ShardGroupSetNeedsSeparateNodeCommand(shardId, enabled); SendCommandToWorkersWithMetadata(metadataCommand); } /* - * ShardGroupSetNeedsIsolatedNode sets the needsisolatednode flag to desired + * ShardGroupSetNeedsSeparateNode sets the needsseparatenode flag to desired * value for all the shards within the shard group that given shard belongs * to. */ void -ShardGroupSetNeedsIsolatedNode(uint64 shardId, bool enabled) +ShardGroupSetNeedsSeparateNode(uint64 shardId, bool enabled) { ShardInterval *shardInterval = LoadShardInterval(shardId); List *colocatedShardIntervalList = ColocatedShardIntervalList(shardInterval); @@ -450,18 +450,18 @@ ShardGroupSetNeedsIsolatedNode(uint64 shardId, bool enabled) ShardInterval *colocatedShardInterval = NULL; foreach_ptr(colocatedShardInterval, colocatedShardIntervalList) { - ShardSetNeedsIsolatedNode(colocatedShardInterval->shardId, + ShardSetNeedsSeparateNode(colocatedShardInterval->shardId, enabled); } } /* - * ShardSetNeedsIsolatedNode sets the needsisolatednode flag to desired + * ShardSetNeedsSeparateNode sets the needsseparatenode flag to desired * value for the given shard. */ static void -ShardSetNeedsIsolatedNode(uint64 shardId, bool enabled) +ShardSetNeedsSeparateNode(uint64 shardId, bool enabled) { Relation pgDistShard = table_open(DistShardRelationId(), RowExclusiveLock); @@ -492,9 +492,9 @@ ShardSetNeedsIsolatedNode(uint64 shardId, bool enabled) memset(isnull, false, sizeof(isnull)); memset(replace, false, sizeof(replace)); - values[Anum_pg_dist_shard_needsisolatednode - 1] = BoolGetDatum(enabled); - isnull[Anum_pg_dist_shard_needsisolatednode - 1] = false; - replace[Anum_pg_dist_shard_needsisolatednode - 1] = true; + values[Anum_pg_dist_shard_needsseparatenode - 1] = BoolGetDatum(enabled); + isnull[Anum_pg_dist_shard_needsseparatenode - 1] = false; + replace[Anum_pg_dist_shard_needsseparatenode - 1] = true; TupleDesc tupleDescriptor = RelationGetDescr(pgDistShard); heapTuple = heap_modify_tuple(heapTuple, tupleDescriptor, values, isnull, replace); @@ -1453,7 +1453,7 @@ CopyShardInterval(ShardInterval *srcInterval) destInterval->maxValueExists = srcInterval->maxValueExists; destInterval->shardId = srcInterval->shardId; destInterval->shardIndex = srcInterval->shardIndex; - destInterval->needsIsolatedNode = srcInterval->needsIsolatedNode; + destInterval->needsSeparateNode = srcInterval->needsSeparateNode; destInterval->minValue = 0; if (destInterval->minValueExists) @@ -1502,15 +1502,15 @@ ShardLength(uint64 shardId) /* - * NodeGroupGetIsolatedShardPlacementGroup returns the shard placement group - * that given node group is used to isolate, if any. Returns NULL if this - * node is not used to a shard placement group. + * NodeGroupGetSeparatedShardPlacementGroup returns the shard placement group + * that given node group is used to separate from others. Returns NULL if this + * node is not used to separate a shard placement group. */ ShardPlacementGroup * -NodeGroupGetIsolatedShardPlacementGroup(int32 groupId) +NodeGroupGetSeparatedShardPlacementGroup(int32 groupId) { ShardPlacementGroup *nodeShardPlacementGroup = NULL; - bool shardPlacementGroupNeedsIsolatedNode = false; + bool shardPlacementGroupNeedsSeparateNode = false; bool indexOK = false; int scanKeyCount = 1; @@ -1555,7 +1555,7 @@ NodeGroupGetIsolatedShardPlacementGroup(int32 groupId) } nodeShardPlacementGroup = shardPlacementGroup; - shardPlacementGroupNeedsIsolatedNode = shardInterval->needsIsolatedNode; + shardPlacementGroupNeedsSeparateNode = shardInterval->needsSeparateNode; heapTuple = systable_getnext(scanDescriptor); } @@ -1563,7 +1563,7 @@ NodeGroupGetIsolatedShardPlacementGroup(int32 groupId) systable_endscan(scanDescriptor); table_close(pgDistPlacement, NoLock); - if (!shardPlacementGroupNeedsIsolatedNode) + if (!shardPlacementGroupNeedsSeparateNode) { return NULL; } @@ -2011,7 +2011,7 @@ IsDummyPlacement(ShardPlacement *taskPlacement) void InsertShardRow(Oid relationId, uint64 shardId, char storageType, text *shardMinValue, text *shardMaxValue, - bool needsIsolatedNode) + bool needsSeparateNode) { Datum values[Natts_pg_dist_shard]; bool isNulls[Natts_pg_dist_shard]; @@ -2023,7 +2023,7 @@ InsertShardRow(Oid relationId, uint64 shardId, char storageType, values[Anum_pg_dist_shard_logicalrelid - 1] = ObjectIdGetDatum(relationId); values[Anum_pg_dist_shard_shardid - 1] = Int64GetDatum(shardId); values[Anum_pg_dist_shard_shardstorage - 1] = CharGetDatum(storageType); - values[Anum_pg_dist_shard_needsisolatednode - 1] = BoolGetDatum(needsIsolatedNode); + values[Anum_pg_dist_shard_needsseparatenode - 1] = BoolGetDatum(needsSeparateNode); /* dropped shardalias column must also be set; it is still part of the tuple */ isNulls[Anum_pg_dist_shard_shardalias_DROPPED - 1] = true; diff --git a/src/backend/distributed/operations/citus_split_shard_by_split_points.c b/src/backend/distributed/operations/citus_split_shard_by_split_points.c index 1ba9ffa48..12e1441e2 100644 --- a/src/backend/distributed/operations/citus_split_shard_by_split_points.c +++ b/src/backend/distributed/operations/citus_split_shard_by_split_points.c @@ -54,8 +54,8 @@ citus_split_shard_by_split_points(PG_FUNCTION_ARGS) Oid shardTransferModeOid = PG_GETARG_OID(3); SplitMode shardSplitMode = LookupSplitMode(shardTransferModeOid); - /* we don't inherit needsisolatednode for new shards */ - List *needsIsolatedNodeForPlacementList = + /* we don't inherit needsseparatenode for new shards */ + List *needsSeparateNodeForPlacementList = GenerateListFromIntElement(false, list_length(nodeIdsForPlacementList)); DistributionColumnMap *distributionColumnOverrides = NULL; @@ -66,7 +66,7 @@ citus_split_shard_by_split_points(PG_FUNCTION_ARGS) shardIdToSplit, shardSplitPointsList, nodeIdsForPlacementList, - needsIsolatedNodeForPlacementList, + needsSeparateNodeForPlacementList, distributionColumnOverrides, sourceColocatedShardIntervalList, INVALID_COLOCATION_ID); diff --git a/src/backend/distributed/operations/create_shards.c b/src/backend/distributed/operations/create_shards.c index eb7a2fde4..8980fba1f 100644 --- a/src/backend/distributed/operations/create_shards.c +++ b/src/backend/distributed/operations/create_shards.c @@ -190,9 +190,9 @@ CreateShardsWithRoundRobinPolicy(Oid distributedTableId, int32 shardCount, text *minHashTokenText = IntegerToText(shardMinHashToken); text *maxHashTokenText = IntegerToText(shardMaxHashToken); - bool needsIsolatedNode = false; + bool needsSeparateNode = false; InsertShardRow(distributedTableId, *shardIdPtr, shardStorageType, - minHashTokenText, maxHashTokenText, needsIsolatedNode); + minHashTokenText, maxHashTokenText, needsSeparateNode); InsertShardPlacementRows(distributedTableId, *shardIdPtr, @@ -290,9 +290,9 @@ CreateColocatedShards(Oid targetRelationId, Oid sourceRelationId, bool sourceShardId); /* inherit from the colocated shard */ - bool needsIsolatedNode = sourceShardInterval->needsIsolatedNode; + bool needsSeparateNode = sourceShardInterval->needsSeparateNode; InsertShardRow(targetRelationId, *newShardIdPtr, targetShardStorageType, - shardMinValueText, shardMaxValueText, needsIsolatedNode); + shardMinValueText, shardMaxValueText, needsSeparateNode); ShardPlacement *sourcePlacement = NULL; foreach_ptr(sourcePlacement, sourceShardPlacementList) @@ -374,9 +374,9 @@ CreateReferenceTableShard(Oid distributedTableId) /* get the next shard id */ uint64 shardId = GetNextShardId(); - bool needsIsolatedNode = false; + bool needsSeparateNode = false; InsertShardRow(distributedTableId, shardId, shardStorageType, shardMinValue, - shardMaxValue, needsIsolatedNode); + shardMaxValue, needsSeparateNode); InsertShardPlacementRows(distributedTableId, shardId, @@ -431,9 +431,9 @@ CreateSingleShardTableShardWithRoundRobinPolicy(Oid relationId, uint32 colocatio text *minHashTokenText = NULL; text *maxHashTokenText = NULL; uint64 shardId = GetNextShardId(); - bool needsIsolatedNode = false; + bool needsSeparateNode = false; InsertShardRow(relationId, shardId, shardStorageType, - minHashTokenText, maxHashTokenText, needsIsolatedNode); + minHashTokenText, maxHashTokenText, needsSeparateNode); int replicationFactor = 1; InsertShardPlacementRows(relationId, diff --git a/src/backend/distributed/operations/isolate_shards.c b/src/backend/distributed/operations/isolate_shards.c index 5bd798d07..0fb669fb9 100644 --- a/src/backend/distributed/operations/isolate_shards.c +++ b/src/backend/distributed/operations/isolate_shards.c @@ -166,8 +166,8 @@ isolate_tenant_to_new_shard(PG_FUNCTION_ARGS) nodeIdsForPlacementList = lappend_int(nodeIdsForPlacementList, sourceNodeId); } - /* we don't inherit needsisolatednode for new shards */ - List *needsIsolatedNodeForPlacementList = + /* we don't inherit needsseparatenode for new shards */ + List *needsSeparateNodeForPlacementList = GenerateListFromIntElement(false, list_length(nodeIdsForPlacementList)); DistributionColumnMap *distributionColumnOverrides = NULL; @@ -178,7 +178,7 @@ isolate_tenant_to_new_shard(PG_FUNCTION_ARGS) sourceShard->shardId, shardSplitPointsList, nodeIdsForPlacementList, - needsIsolatedNodeForPlacementList, + needsSeparateNodeForPlacementList, distributionColumnOverrides, sourceColocatedShardIntervalList, INVALID_COLOCATION_ID); diff --git a/src/backend/distributed/operations/rebalancer_placement_isolation.c b/src/backend/distributed/operations/rebalancer_placement_isolation.c index 623459545..9cbec0a45 100644 --- a/src/backend/distributed/operations/rebalancer_placement_isolation.c +++ b/src/backend/distributed/operations/rebalancer_placement_isolation.c @@ -1,8 +1,8 @@ /*------------------------------------------------------------------------- * * rebalancer_placement_isolation.c - * Routines to determine which worker node should be used to isolate - * a colocated set of shard placements that needs isolation. + * Routines to determine which worker node should be used to separate + * a colocated set of shard placements that need separate nodes. * * Copyright (c) Citus Data, Inc. * @@ -32,7 +32,8 @@ struct RebalancerPlacementIsolationContext /* * Entry of the hash table that maps each primary worker node to a shard - * placement group that is determined to be isolated on that node. + * placement group that is determined to be separated from other shards in + * the cluster via that node. */ typedef struct { @@ -48,20 +49,21 @@ typedef struct bool shouldHaveShards; /* - * Whether given node is allowed to isolate any shard placement groups. + * Whether given node is allowed to separate any shard placement groups. * * This is set only if we're draining a single node because otherwise - * we have the control to isolate shard placement groups on any node. + * we have the control to separate shard placement groups on any node. * - * However if we're draining a single node, we cannot isolate shard + * However if we're draining a single node, we cannot separate shard * placement groups on the node that already has some placements because * we cannot move the existing placements from a node that we're not * draining to another node when we're draining a single node. */ - bool allowedToIsolateAnyPlacementGroup; + bool allowedToSeparateAnyPlacementGroup; /* - * Shard placement group that is assigned to this node to be isolated. + * Shard placement group that is assigned to this node to be separated + * from others in the cluster. * * NULL if no shard placement group is assigned yet. */ @@ -93,8 +95,8 @@ static int WorkerNodeListGetNodeWithGroupId(List *workerNodeList, int32 nodeGrou /* * PrepareRebalancerPlacementIsolationContext creates RebalancerPlacementIsolationContext - * that keeps track of which worker nodes are used to isolate which shard placement groups - * that need an isolated node. + * that keeps track of which worker nodes are used to separate which shard placement groups + * that need separate nodes. */ RebalancerPlacementIsolationContext * PrepareRebalancerPlacementIsolationContext(List *activeWorkerNodeList, @@ -151,25 +153,26 @@ NodePlacementGroupHashInit(HTAB *nodePlacementGroupHash, List *workerNodeList, } nodePlacementGroupHashEntry->shouldHaveShards = shouldHaveShards; - nodePlacementGroupHashEntry->allowedToIsolateAnyPlacementGroup = shouldHaveShards; + nodePlacementGroupHashEntry->allowedToSeparateAnyPlacementGroup = + shouldHaveShards; nodePlacementGroupHashEntry->assignedPlacementGroup = NULL; /* * For the rest of the comment, assume that: * Node D: the node we're draining * Node I: a node that is not D and that has a shard placement group - * that needs an isolated node + * that needs a separate node * Node R: a node that is not D and that has some regular shard * placements * * If we're draining a single node, then we don't know whether other - * nodes have any regular shard placements or any that need an isolated + * nodes have any regular shard placements or any that need a separate * node because in that case GetRebalanceSteps() would provide a list of * shard placements that are stored on D, not a list that contains all * the placements accross the cluster (because we want to limit node * draining to that node in that case). Note that when all shard * placements in the cluster are provided, NodePlacementGroupHashAssignNodes() - * would already be aware of which node is used to isolate which shard + * would already be aware of which node is used to separate which shard * placement group or which node is used to store some regular shard * placements. That is why we skip below code if we're not draining a * single node. It's not only inefficient to run below code when we're @@ -181,9 +184,9 @@ NodePlacementGroupHashInit(HTAB *nodePlacementGroupHash, List *workerNodeList, * * Below we find out the assigned placement groups for nodes of type * I because we want to avoid from moving the placements (if any) from - * node D to node I. We also set allowedToIsolateAnyPlacementGroup to + * node D to node I. We also set allowedToSeparateAnyPlacementGroup to * false for the nodes that already have some shard placements because - * we want to avoid from moving the placements that need an isolated node + * we want to avoid from moving the placements that need a separate node * (if any) from node D to node R. */ if (!(shouldHaveShards && drainSingleNode)) @@ -191,17 +194,17 @@ NodePlacementGroupHashInit(HTAB *nodePlacementGroupHash, List *workerNodeList, continue; } - ShardPlacementGroup *isolatedShardPlacementGroup = - NodeGroupGetIsolatedShardPlacementGroup( + ShardPlacementGroup *separatedShardPlacementGroup = + NodeGroupGetSeparatedShardPlacementGroup( nodePlacementGroupHashEntry->nodeGroupId); - if (isolatedShardPlacementGroup) + if (separatedShardPlacementGroup) { nodePlacementGroupHashEntry->assignedPlacementGroup = - isolatedShardPlacementGroup; + separatedShardPlacementGroup; } else { - nodePlacementGroupHashEntry->allowedToIsolateAnyPlacementGroup = + nodePlacementGroupHashEntry->allowedToSeparateAnyPlacementGroup = !NodeGroupHasShardPlacements(nodePlacementGroupHashEntry->nodeGroupId); } } @@ -210,7 +213,7 @@ NodePlacementGroupHashInit(HTAB *nodePlacementGroupHash, List *workerNodeList, /* * NodePlacementGroupHashAssignNodes assigns all active shard placements in - * the cluster that need to be isolated to individual worker nodes. + * the cluster that need separate nodes to individual worker nodes. */ static void NodePlacementGroupHashAssignNodes(HTAB *nodePlacementGroupHash, @@ -228,7 +231,7 @@ NodePlacementGroupHashAssignNodes(HTAB *nodePlacementGroupHash, foreach_ptr(shardPlacement, shardPlacementList) { ShardInterval *shardInterval = LoadShardInterval(shardPlacement->shardId); - if (!shardInterval->needsIsolatedNode) + if (!shardInterval->needsSeparateNode) { continue; } @@ -259,8 +262,8 @@ NodePlacementGroupHashAssignNodes(HTAB *nodePlacementGroupHash, ShardPlacement *unassignedShardPlacement = NULL; foreach_ptr(unassignedShardPlacement, unassignedShardPlacementList) { - bool isolated = false; - while (!isolated && availableNodeIdx < list_length(availableWorkerList)) + bool separated = false; + while (!separated && availableNodeIdx < list_length(availableWorkerList)) { WorkerNode *availableWorkerNode = (WorkerNode *) list_nth(availableWorkerList, availableNodeIdx); @@ -270,15 +273,15 @@ NodePlacementGroupHashAssignNodes(HTAB *nodePlacementGroupHash, availableWorkerNode->groupId, unassignedShardPlacement)) { - isolated = true; + separated = true; break; } } - if (!isolated) + if (!separated) { - ereport(WARNING, (errmsg("could not isolate all shard placements " - "that need an isolated node"))); + ereport(WARNING, (errmsg("could not separate all shard placements " + "that need a separate node"))); return; } } @@ -317,7 +320,7 @@ NodePlacementGroupHashAssignNode(HTAB *nodePlacementGroupHash, return false; } - if (!nodePlacementGroupHashEntry->allowedToIsolateAnyPlacementGroup) + if (!nodePlacementGroupHashEntry->allowedToSeparateAnyPlacementGroup) { return false; } @@ -351,10 +354,10 @@ RebalancerPlacementIsolationContextPlacementIsAllowedOnWorker( workerNode->groupId); ShardInterval *shardInterval = LoadShardInterval(shardId); - if (!shardInterval->needsIsolatedNode) + if (!shardInterval->needsSeparateNode) { /* - * It doesn't need an isolated node, but is the node used to isolate + * It doesn't need a separate node, but is the node used to separate * a shard placement group? If so, we cannot store it on this node. */ return nodePlacementGroupHashEntry->shouldHaveShards && @@ -362,8 +365,8 @@ RebalancerPlacementIsolationContextPlacementIsAllowedOnWorker( } /* - * Given shard placement needs an isolated node. - * Check if given worker node is the one that is assigned to isolate it. + * Given shard placement needs a separate node. + * Check if given worker node is the one that is assigned to separate it. */ ShardPlacementGroup *placementGroup = GetShardPlacementGroupForPlacement(shardId, placementId); diff --git a/src/backend/distributed/operations/shard_split.c b/src/backend/distributed/operations/shard_split.c index d7bf1bc62..6c146a6ad 100644 --- a/src/backend/distributed/operations/shard_split.c +++ b/src/backend/distributed/operations/shard_split.c @@ -94,24 +94,24 @@ static void CreateObjectOnPlacement(List *objectCreationCommandList, WorkerNode *workerNode); static List * CreateSplitIntervalsForShardGroup(List *sourceColocatedShardList, List *splitPointsForShard, - List *needsIsolatedNodeForShardList); + List *needsSeparateNodeForShardList); static void CreateSplitIntervalsForShard(ShardInterval *sourceShard, List *splitPointsForShard, - List *needsIsolatedNodeForShardList, + List *needsSeparateNodeForShardList, List **shardSplitChildrenIntervalList); static void BlockingShardSplit(SplitOperation splitOperation, uint64 splitWorkflowId, List *sourceColocatedShardIntervalList, List *shardSplitPointsList, List *workersForPlacementList, - List *needsIsolatedNodeForShardList, + List *needsSeparateNodeForShardList, DistributionColumnMap *distributionColumnOverrides); static void NonBlockingShardSplit(SplitOperation splitOperation, uint64 splitWorkflowId, List *sourceColocatedShardIntervalList, List *shardSplitPointsList, List *workersForPlacementList, - List *needsIsolatedNodeForShardList, + List *needsSeparateNodeForShardList, DistributionColumnMap *distributionColumnOverrides, uint32 targetColocationId); static void DoSplitCopy(WorkerNode *sourceShardNode, @@ -429,7 +429,7 @@ GetWorkerNodesFromWorkerIds(List *nodeIdsForPlacementList) * 'shardInterval' : Source shard interval to be split. * 'shardSplitPointsList' : Split Points list for the source 'shardInterval'. * 'nodeIdsForPlacementList' : Placement list corresponding to split children. - * 'needsIsolatedNodeForShardList' : Whether each split children needs an isolated node. + * 'needsSeparateNodeForShardList' : Whether each split children needs a separate node. * 'distributionColumnOverrides' : Maps relation IDs to distribution columns. * If not specified, the distribution column is read * from the metadata. @@ -444,7 +444,7 @@ SplitShard(SplitMode splitMode, uint64 shardIdToSplit, List *shardSplitPointsList, List *nodeIdsForPlacementList, - List *needsIsolatedNodeForShardList, + List *needsSeparateNodeForShardList, DistributionColumnMap *distributionColumnOverrides, List *colocatedShardIntervalList, uint32 targetColocationId) @@ -518,7 +518,7 @@ SplitShard(SplitMode splitMode, sourceColocatedShardIntervalList, shardSplitPointsList, workersForPlacementList, - needsIsolatedNodeForShardList, + needsSeparateNodeForShardList, distributionColumnOverrides); } else @@ -531,7 +531,7 @@ SplitShard(SplitMode splitMode, sourceColocatedShardIntervalList, shardSplitPointsList, workersForPlacementList, - needsIsolatedNodeForShardList, + needsSeparateNodeForShardList, distributionColumnOverrides, targetColocationId); @@ -553,7 +553,7 @@ SplitShard(SplitMode splitMode, * sourceColocatedShardIntervalList : Source shard group to be split. * shardSplitPointsList : Split Points list for the source 'shardInterval'. * workersForPlacementList : Placement list corresponding to split children. - * needsIsolatedNodeForShardList : Whether each split children needs an isolated node. + * needsSeparateNodeForShardList : Whether each split children needs a separate node. */ static void BlockingShardSplit(SplitOperation splitOperation, @@ -561,7 +561,7 @@ BlockingShardSplit(SplitOperation splitOperation, List *sourceColocatedShardIntervalList, List *shardSplitPointsList, List *workersForPlacementList, - List *needsIsolatedNodeForShardList, + List *needsSeparateNodeForShardList, DistributionColumnMap *distributionColumnOverrides) { const char *operationName = SplitOperationAPIName[splitOperation]; @@ -572,7 +572,7 @@ BlockingShardSplit(SplitOperation splitOperation, List *shardGroupSplitIntervalListList = CreateSplitIntervalsForShardGroup( sourceColocatedShardIntervalList, shardSplitPointsList, - needsIsolatedNodeForShardList); + needsSeparateNodeForShardList); /* Only single placement allowed (already validated RelationReplicationFactor = 1) */ ShardInterval *firstShard = linitial(sourceColocatedShardIntervalList); @@ -1030,12 +1030,12 @@ CreateObjectOnPlacement(List *objectCreationCommandList, * [ S1_1(-2147483648, 0), S1_2(1, 2147483647) ], // Split Interval List for S1. * [ S2_1(-2147483648, 0), S2_2(1, 2147483647) ] // Split Interval List for S2. * ] - * 'needsIsolatedNodeForShardList': Whether each split children needs an isolated node + * 'needsSeparateNodeForShardList': Whether each split children needs a separate node */ static List * CreateSplitIntervalsForShardGroup(List *sourceColocatedShardIntervalList, List *splitPointsForShard, - List *needsIsolatedNodeForShardList) + List *needsSeparateNodeForShardList) { List *shardGroupSplitIntervalListList = NIL; @@ -1044,7 +1044,7 @@ CreateSplitIntervalsForShardGroup(List *sourceColocatedShardIntervalList, { List *shardSplitIntervalList = NIL; CreateSplitIntervalsForShard(shardToSplitInterval, splitPointsForShard, - needsIsolatedNodeForShardList, + needsSeparateNodeForShardList, &shardSplitIntervalList); shardGroupSplitIntervalListList = lappend(shardGroupSplitIntervalListList, @@ -1063,7 +1063,7 @@ CreateSplitIntervalsForShardGroup(List *sourceColocatedShardIntervalList, static void CreateSplitIntervalsForShard(ShardInterval *sourceShard, List *splitPointsForShard, - List *needsIsolatedNodeForShardList, + List *needsSeparateNodeForShardList, List **shardSplitChildrenIntervalList) { /* For 'N' split points, we will have N+1 shard intervals created. */ @@ -1088,8 +1088,8 @@ CreateSplitIntervalsForShard(ShardInterval *sourceShard, ShardInterval *splitChildShardInterval = CopyShardInterval(sourceShard); splitChildShardInterval->shardIndex = -1; splitChildShardInterval->shardId = GetNextShardIdForSplitChild(); - splitChildShardInterval->needsIsolatedNode = - list_nth_int(needsIsolatedNodeForShardList, index); + splitChildShardInterval->needsSeparateNode = + list_nth_int(needsSeparateNodeForShardList, index); splitChildShardInterval->minValueExists = true; splitChildShardInterval->minValue = currentSplitChildMinValue; splitChildShardInterval->maxValueExists = true; @@ -1192,7 +1192,7 @@ InsertSplitChildrenShardMetadata(List *shardGroupSplitIntervalListList, shardInterval->storageType, IntegerToText(DatumGetInt32(shardInterval->minValue)), IntegerToText(DatumGetInt32(shardInterval->maxValue)), - shardInterval->needsIsolatedNode); + shardInterval->needsSeparateNode); InsertShardPlacementRow( shardInterval->shardId, @@ -1388,7 +1388,7 @@ AcquireNonblockingSplitLock(Oid relationId) * sourceColocatedShardIntervalList : Source shard group to be split. * shardSplitPointsList : Split Points list for the source 'shardInterval'. * workersForPlacementList : Placement list corresponding to split children. - * needsIsolatedNodeForShardList : Whether each split children needs an isolated node. + * needsSeparateNodeForShardList : Whether each split children needs a separate node. * distributionColumnList : Maps relation IDs to distribution columns. * If not specified, the distribution column is read * from the metadata. @@ -1401,7 +1401,7 @@ NonBlockingShardSplit(SplitOperation splitOperation, List *sourceColocatedShardIntervalList, List *shardSplitPointsList, List *workersForPlacementList, - List *needsIsolatedNodeForShardList, + List *needsSeparateNodeForShardList, DistributionColumnMap *distributionColumnOverrides, uint32 targetColocationId) { @@ -1416,7 +1416,7 @@ NonBlockingShardSplit(SplitOperation splitOperation, List *shardGroupSplitIntervalListList = CreateSplitIntervalsForShardGroup( sourceColocatedShardIntervalList, shardSplitPointsList, - needsIsolatedNodeForShardList); + needsSeparateNodeForShardList); ShardInterval *firstShard = linitial(sourceColocatedShardIntervalList); diff --git a/src/backend/distributed/operations/stage_protocol.c b/src/backend/distributed/operations/stage_protocol.c index 793a8f9c4..b93f5c9d4 100644 --- a/src/backend/distributed/operations/stage_protocol.c +++ b/src/backend/distributed/operations/stage_protocol.c @@ -198,9 +198,9 @@ master_create_empty_shard(PG_FUNCTION_ARGS) candidateNodeIndex++; } - bool needsIsolatedNode = false; + bool needsSeparateNode = false; InsertShardRow(relationId, shardId, storageType, nullMinValue, nullMaxValue, - needsIsolatedNode); + needsSeparateNode); CreateAppendDistributedShardPlacements(relationId, shardId, candidateNodeList, ShardReplicationFactor); diff --git a/src/backend/distributed/operations/worker_node_manager.c b/src/backend/distributed/operations/worker_node_manager.c index cadc2c118..8ecdb4864 100644 --- a/src/backend/distributed/operations/worker_node_manager.c +++ b/src/backend/distributed/operations/worker_node_manager.c @@ -285,7 +285,7 @@ NewDistributedTablePlacementNodeList(LOCKMODE lockMode) /* * NodeCanBeUsedForNonIsolatedPlacements returns true if given node can be - * used to store shard placements that don't need isolation. + * used to store shard placements that don't need separate nodes. */ bool NodeCanBeUsedForNonIsolatedPlacements(WorkerNode *node) @@ -300,7 +300,7 @@ NodeCanBeUsedForNonIsolatedPlacements(WorkerNode *node) return false; } - return NodeGroupGetIsolatedShardPlacementGroup(node->groupId) == NULL; + return NodeGroupGetSeparatedShardPlacementGroup(node->groupId) == NULL; } diff --git a/src/backend/distributed/planner/multi_physical_planner.c b/src/backend/distributed/planner/multi_physical_planner.c index 6c0ba5333..fd8540418 100644 --- a/src/backend/distributed/planner/multi_physical_planner.c +++ b/src/backend/distributed/planner/multi_physical_planner.c @@ -4521,7 +4521,7 @@ GenerateSyntheticShardIntervalArray(int partitionCount) shardInterval->shardId = INVALID_SHARD_ID; shardInterval->valueTypeId = INT4OID; - shardInterval->needsIsolatedNode = false; + shardInterval->needsSeparateNode = false; shardIntervalArray[shardIndex] = shardInterval; } diff --git a/src/backend/distributed/sql/citus--12.1-1--12.2-1.sql b/src/backend/distributed/sql/citus--12.1-1--12.2-1.sql index 911ae0a18..305b7f01d 100644 --- a/src/backend/distributed/sql/citus--12.1-1--12.2-1.sql +++ b/src/backend/distributed/sql/citus--12.1-1--12.2-1.sql @@ -4,10 +4,10 @@ #include "udfs/citus_add_rebalance_strategy/12.2-1.sql" -ALTER TABLE pg_dist_shard ADD COLUMN needsisolatednode boolean NOT NULL DEFAULT false; +ALTER TABLE pg_dist_shard ADD COLUMN needsseparatenode boolean NOT NULL DEFAULT false; #include "udfs/citus_internal_add_shard_metadata/12.2-1.sql" -#include "udfs/citus_internal_shard_group_set_needsisolatednode/12.2-1.sql" +#include "udfs/citus_internal_shard_group_set_needsseparatenode/12.2-1.sql" #include "udfs/citus_shard_property_set/12.2-1.sql" DROP VIEW citus_shards; diff --git a/src/backend/distributed/sql/downgrades/citus--12.2-1--12.1-1.sql b/src/backend/distributed/sql/downgrades/citus--12.2-1--12.1-1.sql index 93312f054..61a335192 100644 --- a/src/backend/distributed/sql/downgrades/citus--12.2-1--12.1-1.sql +++ b/src/backend/distributed/sql/downgrades/citus--12.2-1--12.1-1.sql @@ -10,8 +10,8 @@ DROP FUNCTION pg_catalog.citus_internal_add_shard_metadata(regclass, bigint, "ch DROP FUNCTION pg_catalog.citus_shard_property_set(shard_id bigint, anti_affinity boolean); -DROP FUNCTION pg_catalog.citus_internal_shard_group_set_needsisolatednode( +DROP FUNCTION pg_catalog.citus_internal_shard_group_set_needsseparatenode( shard_id bigint, enabled boolean); -ALTER TABLE pg_dist_shard DROP COLUMN needsisolatednode; +ALTER TABLE pg_dist_shard DROP COLUMN needsseparatenode; diff --git a/src/backend/distributed/sql/udfs/citus_internal_add_shard_metadata/12.2-1.sql b/src/backend/distributed/sql/udfs/citus_internal_add_shard_metadata/12.2-1.sql index 482d93df4..78f3e8f54 100644 --- a/src/backend/distributed/sql/udfs/citus_internal_add_shard_metadata/12.2-1.sql +++ b/src/backend/distributed/sql/udfs/citus_internal_add_shard_metadata/12.2-1.sql @@ -1,8 +1,8 @@ --- create a new function, with needs_isolated_node +-- create a new function, with needs_separate_node CREATE OR REPLACE FUNCTION pg_catalog.citus_internal_add_shard_metadata( relation_id regclass, shard_id bigint, storage_type "char", shard_min_value text, - shard_max_value text, needs_isolated_node boolean + shard_max_value text, needs_separate_node boolean ) RETURNS void LANGUAGE C @@ -10,7 +10,7 @@ CREATE OR REPLACE FUNCTION pg_catalog.citus_internal_add_shard_metadata( COMMENT ON FUNCTION pg_catalog.citus_internal_add_shard_metadata(regclass, bigint, "char", text, text, boolean) IS 'Inserts into pg_dist_shard with user checks'; --- replace the old one so it would call the old C function without needs_isolated_node +-- replace the old one so it would call the old C function without needs_separate_node CREATE OR REPLACE FUNCTION pg_catalog.citus_internal_add_shard_metadata( relation_id regclass, shard_id bigint, storage_type "char", shard_min_value text, diff --git a/src/backend/distributed/sql/udfs/citus_internal_add_shard_metadata/latest.sql b/src/backend/distributed/sql/udfs/citus_internal_add_shard_metadata/latest.sql index 482d93df4..78f3e8f54 100644 --- a/src/backend/distributed/sql/udfs/citus_internal_add_shard_metadata/latest.sql +++ b/src/backend/distributed/sql/udfs/citus_internal_add_shard_metadata/latest.sql @@ -1,8 +1,8 @@ --- create a new function, with needs_isolated_node +-- create a new function, with needs_separate_node CREATE OR REPLACE FUNCTION pg_catalog.citus_internal_add_shard_metadata( relation_id regclass, shard_id bigint, storage_type "char", shard_min_value text, - shard_max_value text, needs_isolated_node boolean + shard_max_value text, needs_separate_node boolean ) RETURNS void LANGUAGE C @@ -10,7 +10,7 @@ CREATE OR REPLACE FUNCTION pg_catalog.citus_internal_add_shard_metadata( COMMENT ON FUNCTION pg_catalog.citus_internal_add_shard_metadata(regclass, bigint, "char", text, text, boolean) IS 'Inserts into pg_dist_shard with user checks'; --- replace the old one so it would call the old C function without needs_isolated_node +-- replace the old one so it would call the old C function without needs_separate_node CREATE OR REPLACE FUNCTION pg_catalog.citus_internal_add_shard_metadata( relation_id regclass, shard_id bigint, storage_type "char", shard_min_value text, diff --git a/src/backend/distributed/sql/udfs/citus_internal_shard_group_set_needsisolatednode/12.2-1.sql b/src/backend/distributed/sql/udfs/citus_internal_shard_group_set_needsseparatenode/12.2-1.sql similarity index 86% rename from src/backend/distributed/sql/udfs/citus_internal_shard_group_set_needsisolatednode/12.2-1.sql rename to src/backend/distributed/sql/udfs/citus_internal_shard_group_set_needsseparatenode/12.2-1.sql index 48783b177..541c8cf14 100644 --- a/src/backend/distributed/sql/udfs/citus_internal_shard_group_set_needsisolatednode/12.2-1.sql +++ b/src/backend/distributed/sql/udfs/citus_internal_shard_group_set_needsseparatenode/12.2-1.sql @@ -1,6 +1,6 @@ -CREATE OR REPLACE FUNCTION pg_catalog.citus_internal_shard_group_set_needsisolatednode( +CREATE OR REPLACE FUNCTION pg_catalog.citus_internal_shard_group_set_needsseparatenode( shard_id bigint, enabled boolean) RETURNS void LANGUAGE C VOLATILE - AS 'MODULE_PATHNAME', $$citus_internal_shard_group_set_needsisolatednode$$; + AS 'MODULE_PATHNAME', $$citus_internal_shard_group_set_needsseparatenode$$; diff --git a/src/backend/distributed/sql/udfs/citus_internal_shard_group_set_needsisolatednode/latest.sql b/src/backend/distributed/sql/udfs/citus_internal_shard_group_set_needsseparatenode/latest.sql similarity index 86% rename from src/backend/distributed/sql/udfs/citus_internal_shard_group_set_needsisolatednode/latest.sql rename to src/backend/distributed/sql/udfs/citus_internal_shard_group_set_needsseparatenode/latest.sql index 48783b177..541c8cf14 100644 --- a/src/backend/distributed/sql/udfs/citus_internal_shard_group_set_needsisolatednode/latest.sql +++ b/src/backend/distributed/sql/udfs/citus_internal_shard_group_set_needsseparatenode/latest.sql @@ -1,6 +1,6 @@ -CREATE OR REPLACE FUNCTION pg_catalog.citus_internal_shard_group_set_needsisolatednode( +CREATE OR REPLACE FUNCTION pg_catalog.citus_internal_shard_group_set_needsseparatenode( shard_id bigint, enabled boolean) RETURNS void LANGUAGE C VOLATILE - AS 'MODULE_PATHNAME', $$citus_internal_shard_group_set_needsisolatednode$$; + AS 'MODULE_PATHNAME', $$citus_internal_shard_group_set_needsseparatenode$$; diff --git a/src/backend/distributed/sql/udfs/citus_shards/12.2-1.sql b/src/backend/distributed/sql/udfs/citus_shards/12.2-1.sql index c5118ff09..83e93a37f 100644 --- a/src/backend/distributed/sql/udfs/citus_shards/12.2-1.sql +++ b/src/backend/distributed/sql/udfs/citus_shards/12.2-1.sql @@ -13,7 +13,7 @@ SELECT pg_dist_node.nodeport, size as shard_size, CASE - WHEN NOT pg_dist_shard.needsisolatednode THEN false + WHEN NOT pg_dist_shard.needsseparatenode THEN false ELSE -- has_separate_node = true if the node doesn't have any other shards except the ones that are colocated with this shard NOT EXISTS ( diff --git a/src/backend/distributed/sql/udfs/citus_shards/latest.sql b/src/backend/distributed/sql/udfs/citus_shards/latest.sql index c5118ff09..83e93a37f 100644 --- a/src/backend/distributed/sql/udfs/citus_shards/latest.sql +++ b/src/backend/distributed/sql/udfs/citus_shards/latest.sql @@ -13,7 +13,7 @@ SELECT pg_dist_node.nodeport, size as shard_size, CASE - WHEN NOT pg_dist_shard.needsisolatednode THEN false + WHEN NOT pg_dist_shard.needsseparatenode THEN false ELSE -- has_separate_node = true if the node doesn't have any other shards except the ones that are colocated with this shard NOT EXISTS ( diff --git a/src/backend/distributed/test/distribution_metadata.c b/src/backend/distributed/test/distribution_metadata.c index f322e149c..03a8b0ae4 100644 --- a/src/backend/distributed/test/distribution_metadata.c +++ b/src/backend/distributed/test/distribution_metadata.c @@ -228,9 +228,9 @@ create_monolithic_shard_row(PG_FUNCTION_ARGS) text *minInfoText = cstring_to_text(minInfo->data); text *maxInfoText = cstring_to_text(maxInfo->data); - bool needsIsolatedNode = false; + bool needsSeparateNode = false; InsertShardRow(distributedTableId, newShardId, SHARD_STORAGE_TABLE, minInfoText, - maxInfoText, needsIsolatedNode); + maxInfoText, needsSeparateNode); PG_RETURN_INT64(newShardId); } diff --git a/src/include/distributed/metadata_sync.h b/src/include/distributed/metadata_sync.h index 8b0f87854..e1755a27d 100644 --- a/src/include/distributed/metadata_sync.h +++ b/src/include/distributed/metadata_sync.h @@ -141,7 +141,7 @@ extern char * TenantSchemaInsertCommand(Oid schemaId, uint32 colocationId); extern char * TenantSchemaDeleteCommand(char *schemaName); extern char * UpdateNoneDistTableMetadataCommand(Oid relationId, char replicationModel, uint32 colocationId, bool autoConverted); -extern char * ShardGroupSetNeedsIsolatedNodeCommand(uint64 shardId, bool enabled); +extern char * ShardGroupSetNeedsSeparateNodeCommand(uint64 shardId, bool enabled); extern char * AddPlacementMetadataCommand(uint64 shardId, uint64 placementId, uint64 shardLength, int32 groupId); extern char * DeletePlacementMetadataCommand(uint64 placementId); diff --git a/src/include/distributed/metadata_utility.h b/src/include/distributed/metadata_utility.h index 8ae377877..17bd8a4a8 100644 --- a/src/include/distributed/metadata_utility.h +++ b/src/include/distributed/metadata_utility.h @@ -67,7 +67,7 @@ typedef struct ShardInterval Datum maxValue; /* a shard's typed max value datum */ uint64 shardId; int shardIndex; - bool needsIsolatedNode; + bool needsSeparateNode; } ShardInterval; @@ -331,7 +331,7 @@ extern int ShardIntervalCount(Oid relationId); extern List * LoadShardList(Oid relationId); extern ShardInterval * CopyShardInterval(ShardInterval *srcInterval); extern uint64 ShardLength(uint64 shardId); -extern ShardPlacementGroup * NodeGroupGetIsolatedShardPlacementGroup(int32 groupId); +extern ShardPlacementGroup * NodeGroupGetSeparatedShardPlacementGroup(int32 groupId); extern bool ShardPlacementGroupsSame(const ShardPlacementGroup *leftGroup, const ShardPlacementGroup *rightGroup); extern bool NodeGroupHasShardPlacements(int32 groupId); @@ -363,7 +363,7 @@ extern List * RemoveCoordinatorPlacementIfNotSingleNode(List *placementList); /* Function declarations to modify shard and shard placement data */ extern void InsertShardRow(Oid relationId, uint64 shardId, char storageType, text *shardMinValue, text *shardMaxValue, - bool needsIsolatedNode); + bool needsSeparateNode); extern void DeleteShardRow(uint64 shardId); extern ShardPlacement * InsertShardPlacementRowGlobally(uint64 shardId, uint64 placementId, @@ -446,7 +446,7 @@ extern List * SendShardStatisticsQueriesInParallel(List *citusTableIds, extern bool GetNodeDiskSpaceStatsForConnection(MultiConnection *connection, uint64 *availableBytes, uint64 *totalBytes); -extern void ShardGroupSetNeedsIsolatedNode(uint64 shardId, bool enabled); +extern void ShardGroupSetNeedsSeparateNode(uint64 shardId, bool enabled); extern void ExecuteQueryViaSPI(char *query, int SPIOK); extern void ExecuteAndLogQueryViaSPI(char *query, int SPIOK, int logLevel); extern void EnsureSequenceTypeSupported(Oid seqOid, Oid attributeTypeId, Oid diff --git a/src/include/distributed/pg_dist_shard.h b/src/include/distributed/pg_dist_shard.h index f676074d9..1a65bb4f1 100644 --- a/src/include/distributed/pg_dist_shard.h +++ b/src/include/distributed/pg_dist_shard.h @@ -30,7 +30,10 @@ typedef struct FormData_pg_dist_shard text shardminvalue; /* partition key's minimum value in shard */ text shardmaxvalue; /* partition key's maximum value in shard */ #endif - bool needsIsolatedNode; /* whether the placements of this shard need to be isolated */ + bool needsSeparateNode; /* + * Whether the placements of this shard need to be + * separated from others. + */ } FormData_pg_dist_shard; /* ---------------- @@ -51,7 +54,7 @@ typedef FormData_pg_dist_shard *Form_pg_dist_shard; #define Anum_pg_dist_shard_shardalias_DROPPED 4 #define Anum_pg_dist_shard_shardminvalue 5 #define Anum_pg_dist_shard_shardmaxvalue 6 -#define Anum_pg_dist_shard_needsisolatednode 7 +#define Anum_pg_dist_shard_needsseparatenode 7 /* * Valid values for shard storage types include foreign table, (standard) table diff --git a/src/include/distributed/rebalancer_placement_isolation.h b/src/include/distributed/rebalancer_placement_isolation.h index e84ac0561..0b8e3ddc7 100644 --- a/src/include/distributed/rebalancer_placement_isolation.h +++ b/src/include/distributed/rebalancer_placement_isolation.h @@ -1,8 +1,8 @@ /*------------------------------------------------------------------------- * * rebalancer_placement_isolation.h - * Routines to determine which worker node should be used to isolate - * a colocated set of shard placements that need isolation. + * Routines to determine which worker node should be used to separate + * a colocated set of shard placements that need separate nodes. * * Copyright (c) Citus Data, Inc. * diff --git a/src/include/distributed/shard_split.h b/src/include/distributed/shard_split.h index c69db61c8..f874b5151 100644 --- a/src/include/distributed/shard_split.h +++ b/src/include/distributed/shard_split.h @@ -43,7 +43,7 @@ extern void SplitShard(SplitMode splitMode, uint64 shardIdToSplit, List *shardSplitPointsList, List *nodeIdsForPlacementList, - List *needsIsolatedNodeForPlacementList, + List *needsSeparateNodeForPlacementList, DistributionColumnMap *distributionColumnOverrides, List *colocatedShardIntervalList, uint32 targetColocationId); diff --git a/src/test/regress/expected/failure_create_distributed_table_concurrently.out b/src/test/regress/expected/failure_create_distributed_table_concurrently.out index d557a0a47..c824aa30d 100644 --- a/src/test/regress/expected/failure_create_distributed_table_concurrently.out +++ b/src/test/regress/expected/failure_create_distributed_table_concurrently.out @@ -189,7 +189,7 @@ SELECT create_distributed_table_concurrently('table_1', 'id'); (1 row) SELECT * FROM pg_dist_shard WHERE logicalrelid = 'table_1'::regclass; - logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsisolatednode + logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsseparatenode --------------------------------------------------------------------- table_1 | 222247 | t | -2147483648 | -1 | f table_1 | 222248 | t | 0 | 2147483647 | f diff --git a/src/test/regress/expected/isolate_placement.out b/src/test/regress/expected/isolate_placement.out index b4a060164..a0eea6e55 100644 --- a/src/test/regress/expected/isolate_placement.out +++ b/src/test/regress/expected/isolate_placement.out @@ -30,9 +30,9 @@ $func$ LANGUAGE plpgsql; CREATE SCHEMA isolate_placement; SET search_path TO isolate_placement; -- test null input -SELECT citus_internal_shard_group_set_needsisolatednode(0, NULL); +SELECT citus_internal_shard_group_set_needsseparatenode(0, NULL); ERROR: enabled cannot be NULL -SELECT citus_internal_shard_group_set_needsisolatednode(NULL, false); +SELECT citus_internal_shard_group_set_needsseparatenode(NULL, false); ERROR: shard_id cannot be NULL SET citus.shard_replication_factor TO 1; SET citus.next_shard_id TO 2000000; @@ -44,7 +44,7 @@ SELECT create_distributed_table('single_shard_1', null, colocate_with=>'none'); (1 row) -- test with user that doesn't have permission to execute the function -SELECT citus_internal_shard_group_set_needsisolatednode(shardid, true) FROM pg_dist_shard WHERE logicalrelid = 'isolate_placement.single_shard_1'::regclass; +SELECT citus_internal_shard_group_set_needsseparatenode(shardid, true) FROM pg_dist_shard WHERE logicalrelid = 'isolate_placement.single_shard_1'::regclass; ERROR: This is an internal Citus function can only be used in a distributed transaction DROP TABLE single_shard_1; CREATE ROLE test_user_isolate_placement WITH LOGIN; @@ -64,17 +64,17 @@ SELECT pg_sleep(0.1); SET ROLE test_user_isolate_placement; -- test invalid shard id -SELECT citus_internal_shard_group_set_needsisolatednode(0, true); +SELECT citus_internal_shard_group_set_needsseparatenode(0, true); ERROR: could not find valid entry for shard xxxxx --- test null needs_isolated_node +-- test null needs_separate_node SELECT citus_internal_add_shard_metadata( relation_id=>0, shard_id=>0, storage_type=>'0', shard_min_value=>'0', shard_max_value=>'0', - needs_isolated_node=>null); -ERROR: needs isolated node cannot be NULL + needs_separate_node=>null); +ERROR: needs separate node cannot be NULL RESET ROLE; REVOKE ALL ON SCHEMA isolate_placement FROM test_user_isolate_placement; DROP USER test_user_isolate_placement; @@ -124,7 +124,7 @@ SELECT citus_shard_property_set(shardid) FROM pg_dist_shard WHERE logicalrelid = ERROR: must be owner of table single_shard_1 SELECT citus_shard_property_set(shardid, anti_affinity=>true) FROM pg_dist_shard WHERE logicalrelid = 'isolate_placement.single_shard_1'::regclass; ERROR: must be owner of table single_shard_1 -SELECT citus_internal_shard_group_set_needsisolatednode(shardid, true) FROM pg_dist_shard WHERE logicalrelid = 'isolate_placement.single_shard_1'::regclass; +SELECT citus_internal_shard_group_set_needsseparatenode(shardid, true) FROM pg_dist_shard WHERE logicalrelid = 'isolate_placement.single_shard_1'::regclass; ERROR: must be owner of table single_shard_1 -- assign all tables to regularuser RESET ROLE; @@ -154,8 +154,8 @@ ORDER BY result; [{"1": [{"isolate_placement.single_shard_1": true}]}] (3 rows) -SELECT citus_internal_shard_group_set_needsisolatednode(shardid, false) FROM pg_dist_shard WHERE logicalrelid = 'isolate_placement.single_shard_1'::regclass; - citus_internal_shard_group_set_needsisolatednode +SELECT citus_internal_shard_group_set_needsseparatenode(shardid, false) FROM pg_dist_shard WHERE logicalrelid = 'isolate_placement.single_shard_1'::regclass; + citus_internal_shard_group_set_needsseparatenode --------------------------------------------------------------------- (1 row) @@ -171,8 +171,8 @@ ORDER BY result; {} (3 rows) -SELECT citus_internal_shard_group_set_needsisolatednode(shardid, true) FROM pg_dist_shard WHERE logicalrelid = 'isolate_placement.single_shard_1'::regclass; - citus_internal_shard_group_set_needsisolatednode +SELECT citus_internal_shard_group_set_needsseparatenode(shardid, true) FROM pg_dist_shard WHERE logicalrelid = 'isolate_placement.single_shard_1'::regclass; + citus_internal_shard_group_set_needsseparatenode --------------------------------------------------------------------- (1 row) @@ -229,7 +229,7 @@ SELECT create_distributed_table('dist_3', 'a', colocate_with=>'dist_1'); (1 row) SET citus.shard_replication_factor TO 1; --- none of the placements have been marked as needsisolatednode yet +-- none of the placements have been marked as needsseparatenode yet SELECT result FROM run_command_on_all_nodes($$ SELECT * FROM public.get_colocated_shards_needisolatednode('isolate_placement.dist_1') $$) @@ -403,7 +403,7 @@ DETAIL: UPDATE and DELETE commands on the relation will error out during create (1 row) -- Placements of a new distributed table created within the same colocated --- group inherit needsisolatednode from the colocated placements too. +-- group inherit needsseparatenode from the colocated placements too. SELECT result FROM run_command_on_all_nodes($$ SELECT * FROM public.get_colocated_shards_needisolatednode('isolate_placement.dist_1') $$) @@ -602,7 +602,7 @@ WHERE shardid = :shardgroup_9_shardid; (1 row) -- We shouldn't see shard group 9 because shard-split operation doesn't --- preserve needsisolatednode flag when splitting the shard. +-- preserve needsseparatenode flag when splitting the shard. SELECT result FROM run_command_on_all_nodes($$ SELECT * FROM public.get_colocated_shards_needisolatednode('isolate_placement.dist_1') $$) @@ -703,7 +703,7 @@ SELECT 1 FROM isolate_tenant_to_new_shard('dist_3', 100, shard_transfer_mode => (1 row) -- We shouldn't see shard group 17 because isolate_tenant_to_new_shard doesn't --- preserve needsisolatednode flag when splitting the shard. +-- preserve needsseparatenode flag when splitting the shard. SELECT result FROM run_command_on_all_nodes($$ SELECT * FROM public.get_colocated_shards_needisolatednode('isolate_placement.dist_3') $$) diff --git a/src/test/regress/expected/isolation_create_distributed_table_concurrently.out b/src/test/regress/expected/isolation_create_distributed_table_concurrently.out index f6f2702de..c9fa05417 100644 --- a/src/test/regress/expected/isolation_create_distributed_table_concurrently.out +++ b/src/test/regress/expected/isolation_create_distributed_table_concurrently.out @@ -57,7 +57,7 @@ step s2-print-status: -- sanity check on total elements in the table SELECT COUNT(*) FROM table_1; -logicalrelid|shardid|shardstorage|shardminvalue|shardmaxvalue|needsisolatednode +logicalrelid|shardid|shardstorage|shardminvalue|shardmaxvalue|needsseparatenode --------------------------------------------------------------------- table_1 |1400306|t | -2147483648| -1073741825|f table_1 |1400307|t | -1073741824| -1|f @@ -125,7 +125,7 @@ step s2-print-status: -- sanity check on total elements in the table SELECT COUNT(*) FROM table_1; -logicalrelid|shardid|shardstorage|shardminvalue|shardmaxvalue|needsisolatednode +logicalrelid|shardid|shardstorage|shardminvalue|shardmaxvalue|needsseparatenode --------------------------------------------------------------------- table_1 |1400311|t | -2147483648| -1073741825|f table_1 |1400312|t | -1073741824| -1|f @@ -193,7 +193,7 @@ step s2-print-status: -- sanity check on total elements in the table SELECT COUNT(*) FROM table_1; -logicalrelid|shardid|shardstorage|shardminvalue|shardmaxvalue|needsisolatednode +logicalrelid|shardid|shardstorage|shardminvalue|shardmaxvalue|needsseparatenode --------------------------------------------------------------------- table_1 |1400316|t | -2147483648| -1073741825|f table_1 |1400317|t | -1073741824| -1|f @@ -261,7 +261,7 @@ step s2-print-status: -- sanity check on total elements in the table SELECT COUNT(*) FROM table_1; -logicalrelid|shardid|shardstorage|shardminvalue|shardmaxvalue|needsisolatednode +logicalrelid|shardid|shardstorage|shardminvalue|shardmaxvalue|needsseparatenode --------------------------------------------------------------------- table_1 |1400321|t | -2147483648| -1073741825|f table_1 |1400322|t | -1073741824| -1|f diff --git a/src/test/regress/expected/multi_extension.out b/src/test/regress/expected/multi_extension.out index d849f6f95..231cf163f 100644 --- a/src/test/regress/expected/multi_extension.out +++ b/src/test/regress/expected/multi_extension.out @@ -1423,7 +1423,7 @@ SELECT * FROM multi_extension.print_extension_changes(); previous_object | current_object --------------------------------------------------------------------- | function citus_internal_add_shard_metadata(regclass,bigint,"char",text,text,boolean) void - | function citus_internal_shard_group_set_needsisolatednode(bigint,boolean) void + | function citus_internal_shard_group_set_needsseparatenode(bigint,boolean) void | function citus_shard_property_set(bigint,boolean) void (3 rows) diff --git a/src/test/regress/expected/multi_fix_partition_shard_index_names.out b/src/test/regress/expected/multi_fix_partition_shard_index_names.out index a9e856785..b8299f20f 100644 --- a/src/test/regress/expected/multi_fix_partition_shard_index_names.out +++ b/src/test/regress/expected/multi_fix_partition_shard_index_names.out @@ -696,9 +696,9 @@ NOTICE: issuing SELECT citus_internal_add_partition_metadata ('fix_idx_names.p2 DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx NOTICE: issuing SELECT citus_internal_add_partition_metadata ('fix_idx_names.p2'::regclass, 'h', 'dist_col', 1370001, 's') DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx -NOTICE: issuing WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) AS (VALUES ('fix_idx_names.p2'::regclass, 915002, 't'::"char", '-2147483648', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) FROM shard_data; +NOTICE: issuing WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) AS (VALUES ('fix_idx_names.p2'::regclass, 915002, 't'::"char", '-2147483648', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) FROM shard_data; DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx -NOTICE: issuing WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) AS (VALUES ('fix_idx_names.p2'::regclass, 915002, 't'::"char", '-2147483648', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) FROM shard_data; +NOTICE: issuing WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) AS (VALUES ('fix_idx_names.p2'::regclass, 915002, 't'::"char", '-2147483648', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) FROM shard_data; DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx NOTICE: issuing WITH placement_data(shardid, shardlength, groupid, placementid) AS (VALUES (xxxxxx, xxxxxx, xxxxxx, xxxxxx)) SELECT citus_internal_add_placement_metadata(shardid, shardlength, groupid, placementid) FROM placement_data; DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx diff --git a/src/test/regress/expected/multi_join_pruning.out b/src/test/regress/expected/multi_join_pruning.out index 6a948c81e..1df699dae 100644 --- a/src/test/regress/expected/multi_join_pruning.out +++ b/src/test/regress/expected/multi_join_pruning.out @@ -45,7 +45,7 @@ select * from pg_dist_shard where logicalrelid='lineitem'::regclass or logicalrelid='orders'::regclass order by shardid; - logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsisolatednode + logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsseparatenode --------------------------------------------------------------------- lineitem | 360000 | t | -2147483648 | -1 | f lineitem | 360001 | t | 0 | 2147483647 | f diff --git a/src/test/regress/expected/multi_metadata_sync.out b/src/test/regress/expected/multi_metadata_sync.out index 5925ed4bb..8b37107e7 100644 --- a/src/test/regress/expected/multi_metadata_sync.out +++ b/src/test/regress/expected/multi_metadata_sync.out @@ -194,8 +194,8 @@ SELECT unnest(activate_node_snapshot()) order by 1; WITH distributed_object_data(typetext, objnames, objargs, distargumentindex, colocationid, force_delegation) AS (VALUES ('table', ARRAY['public', 'single_shard_tbl']::text[], ARRAY[]::text[], -1, 0, false)) SELECT citus_internal_add_object_metadata(typetext, objnames, objargs, distargumentindex::int, colocationid::int, force_delegation::bool) FROM distributed_object_data; WITH placement_data(shardid, shardlength, groupid, placementid) AS (VALUES (1310000, 0, 1, 100000), (1310001, 0, 2, 100001), (1310002, 0, 1, 100002), (1310003, 0, 2, 100003), (1310004, 0, 1, 100004), (1310005, 0, 2, 100005), (1310006, 0, 1, 100006), (1310007, 0, 2, 100007)) SELECT citus_internal_add_placement_metadata(shardid, shardlength, groupid, placementid) FROM placement_data; WITH placement_data(shardid, shardlength, groupid, placementid) AS (VALUES (1310008, 0, 2, 100008)) SELECT citus_internal_add_placement_metadata(shardid, shardlength, groupid, placementid) FROM placement_data; - WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) AS (VALUES ('public.mx_test_table'::regclass, 1310000, 't'::"char", '-2147483648', '-1610612737', false), ('public.mx_test_table'::regclass, 1310001, 't'::"char", '-1610612736', '-1073741825', false), ('public.mx_test_table'::regclass, 1310002, 't'::"char", '-1073741824', '-536870913', false), ('public.mx_test_table'::regclass, 1310003, 't'::"char", '-536870912', '-1', false), ('public.mx_test_table'::regclass, 1310004, 't'::"char", '0', '536870911', false), ('public.mx_test_table'::regclass, 1310005, 't'::"char", '536870912', '1073741823', false), ('public.mx_test_table'::regclass, 1310006, 't'::"char", '1073741824', '1610612735', false), ('public.mx_test_table'::regclass, 1310007, 't'::"char", '1610612736', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) FROM shard_data; - WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) AS (VALUES ('public.single_shard_tbl'::regclass, 1310008, 't'::"char", NULL, NULL, false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) FROM shard_data; + WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) AS (VALUES ('public.mx_test_table'::regclass, 1310000, 't'::"char", '-2147483648', '-1610612737', false), ('public.mx_test_table'::regclass, 1310001, 't'::"char", '-1610612736', '-1073741825', false), ('public.mx_test_table'::regclass, 1310002, 't'::"char", '-1073741824', '-536870913', false), ('public.mx_test_table'::regclass, 1310003, 't'::"char", '-536870912', '-1', false), ('public.mx_test_table'::regclass, 1310004, 't'::"char", '0', '536870911', false), ('public.mx_test_table'::regclass, 1310005, 't'::"char", '536870912', '1073741823', false), ('public.mx_test_table'::regclass, 1310006, 't'::"char", '1073741824', '1610612735', false), ('public.mx_test_table'::regclass, 1310007, 't'::"char", '1610612736', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) FROM shard_data; + WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) AS (VALUES ('public.single_shard_tbl'::regclass, 1310008, 't'::"char", NULL, NULL, false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) FROM shard_data; (61 rows) -- Drop single shard table @@ -256,7 +256,7 @@ SELECT unnest(activate_node_snapshot()) order by 1; WITH distributed_object_data(typetext, objnames, objargs, distargumentindex, colocationid, force_delegation) AS (VALUES ('sequence', ARRAY['public', 'user_defined_seq']::text[], ARRAY[]::text[], -1, 0, false)) SELECT citus_internal_add_object_metadata(typetext, objnames, objargs, distargumentindex::int, colocationid::int, force_delegation::bool) FROM distributed_object_data; WITH distributed_object_data(typetext, objnames, objargs, distargumentindex, colocationid, force_delegation) AS (VALUES ('table', ARRAY['public', 'mx_test_table']::text[], ARRAY[]::text[], -1, 0, false)) SELECT citus_internal_add_object_metadata(typetext, objnames, objargs, distargumentindex::int, colocationid::int, force_delegation::bool) FROM distributed_object_data; WITH placement_data(shardid, shardlength, groupid, placementid) AS (VALUES (1310000, 0, 1, 100000), (1310001, 0, 2, 100001), (1310002, 0, 1, 100002), (1310003, 0, 2, 100003), (1310004, 0, 1, 100004), (1310005, 0, 2, 100005), (1310006, 0, 1, 100006), (1310007, 0, 2, 100007)) SELECT citus_internal_add_placement_metadata(shardid, shardlength, groupid, placementid) FROM placement_data; - WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) AS (VALUES ('public.mx_test_table'::regclass, 1310000, 't'::"char", '-2147483648', '-1610612737', false), ('public.mx_test_table'::regclass, 1310001, 't'::"char", '-1610612736', '-1073741825', false), ('public.mx_test_table'::regclass, 1310002, 't'::"char", '-1073741824', '-536870913', false), ('public.mx_test_table'::regclass, 1310003, 't'::"char", '-536870912', '-1', false), ('public.mx_test_table'::regclass, 1310004, 't'::"char", '0', '536870911', false), ('public.mx_test_table'::regclass, 1310005, 't'::"char", '536870912', '1073741823', false), ('public.mx_test_table'::regclass, 1310006, 't'::"char", '1073741824', '1610612735', false), ('public.mx_test_table'::regclass, 1310007, 't'::"char", '1610612736', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) FROM shard_data; + WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) AS (VALUES ('public.mx_test_table'::regclass, 1310000, 't'::"char", '-2147483648', '-1610612737', false), ('public.mx_test_table'::regclass, 1310001, 't'::"char", '-1610612736', '-1073741825', false), ('public.mx_test_table'::regclass, 1310002, 't'::"char", '-1073741824', '-536870913', false), ('public.mx_test_table'::regclass, 1310003, 't'::"char", '-536870912', '-1', false), ('public.mx_test_table'::regclass, 1310004, 't'::"char", '0', '536870911', false), ('public.mx_test_table'::regclass, 1310005, 't'::"char", '536870912', '1073741823', false), ('public.mx_test_table'::regclass, 1310006, 't'::"char", '1073741824', '1610612735', false), ('public.mx_test_table'::regclass, 1310007, 't'::"char", '1610612736', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) FROM shard_data; (52 rows) -- Show that schema changes are included in the activate node snapshot @@ -318,7 +318,7 @@ SELECT unnest(activate_node_snapshot()) order by 1; WITH distributed_object_data(typetext, objnames, objargs, distargumentindex, colocationid, force_delegation) AS (VALUES ('sequence', ARRAY['public', 'user_defined_seq']::text[], ARRAY[]::text[], -1, 0, false)) SELECT citus_internal_add_object_metadata(typetext, objnames, objargs, distargumentindex::int, colocationid::int, force_delegation::bool) FROM distributed_object_data; WITH distributed_object_data(typetext, objnames, objargs, distargumentindex, colocationid, force_delegation) AS (VALUES ('table', ARRAY['mx_testing_schema', 'mx_test_table']::text[], ARRAY[]::text[], -1, 0, false)) SELECT citus_internal_add_object_metadata(typetext, objnames, objargs, distargumentindex::int, colocationid::int, force_delegation::bool) FROM distributed_object_data; WITH placement_data(shardid, shardlength, groupid, placementid) AS (VALUES (1310000, 0, 1, 100000), (1310001, 0, 2, 100001), (1310002, 0, 1, 100002), (1310003, 0, 2, 100003), (1310004, 0, 1, 100004), (1310005, 0, 2, 100005), (1310006, 0, 1, 100006), (1310007, 0, 2, 100007)) SELECT citus_internal_add_placement_metadata(shardid, shardlength, groupid, placementid) FROM placement_data; - WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) AS (VALUES ('mx_testing_schema.mx_test_table'::regclass, 1310000, 't'::"char", '-2147483648', '-1610612737', false), ('mx_testing_schema.mx_test_table'::regclass, 1310001, 't'::"char", '-1610612736', '-1073741825', false), ('mx_testing_schema.mx_test_table'::regclass, 1310002, 't'::"char", '-1073741824', '-536870913', false), ('mx_testing_schema.mx_test_table'::regclass, 1310003, 't'::"char", '-536870912', '-1', false), ('mx_testing_schema.mx_test_table'::regclass, 1310004, 't'::"char", '0', '536870911', false), ('mx_testing_schema.mx_test_table'::regclass, 1310005, 't'::"char", '536870912', '1073741823', false), ('mx_testing_schema.mx_test_table'::regclass, 1310006, 't'::"char", '1073741824', '1610612735', false), ('mx_testing_schema.mx_test_table'::regclass, 1310007, 't'::"char", '1610612736', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) FROM shard_data; + WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) AS (VALUES ('mx_testing_schema.mx_test_table'::regclass, 1310000, 't'::"char", '-2147483648', '-1610612737', false), ('mx_testing_schema.mx_test_table'::regclass, 1310001, 't'::"char", '-1610612736', '-1073741825', false), ('mx_testing_schema.mx_test_table'::regclass, 1310002, 't'::"char", '-1073741824', '-536870913', false), ('mx_testing_schema.mx_test_table'::regclass, 1310003, 't'::"char", '-536870912', '-1', false), ('mx_testing_schema.mx_test_table'::regclass, 1310004, 't'::"char", '0', '536870911', false), ('mx_testing_schema.mx_test_table'::regclass, 1310005, 't'::"char", '536870912', '1073741823', false), ('mx_testing_schema.mx_test_table'::regclass, 1310006, 't'::"char", '1073741824', '1610612735', false), ('mx_testing_schema.mx_test_table'::regclass, 1310007, 't'::"char", '1610612736', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) FROM shard_data; (54 rows) -- Show that append distributed tables are not included in the activate node snapshot @@ -386,7 +386,7 @@ SELECT unnest(activate_node_snapshot()) order by 1; WITH distributed_object_data(typetext, objnames, objargs, distargumentindex, colocationid, force_delegation) AS (VALUES ('sequence', ARRAY['public', 'user_defined_seq']::text[], ARRAY[]::text[], -1, 0, false)) SELECT citus_internal_add_object_metadata(typetext, objnames, objargs, distargumentindex::int, colocationid::int, force_delegation::bool) FROM distributed_object_data; WITH distributed_object_data(typetext, objnames, objargs, distargumentindex, colocationid, force_delegation) AS (VALUES ('table', ARRAY['mx_testing_schema', 'mx_test_table']::text[], ARRAY[]::text[], -1, 0, false)) SELECT citus_internal_add_object_metadata(typetext, objnames, objargs, distargumentindex::int, colocationid::int, force_delegation::bool) FROM distributed_object_data; WITH placement_data(shardid, shardlength, groupid, placementid) AS (VALUES (1310000, 0, 1, 100000), (1310001, 0, 2, 100001), (1310002, 0, 1, 100002), (1310003, 0, 2, 100003), (1310004, 0, 1, 100004), (1310005, 0, 2, 100005), (1310006, 0, 1, 100006), (1310007, 0, 2, 100007)) SELECT citus_internal_add_placement_metadata(shardid, shardlength, groupid, placementid) FROM placement_data; - WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) AS (VALUES ('mx_testing_schema.mx_test_table'::regclass, 1310000, 't'::"char", '-2147483648', '-1610612737', false), ('mx_testing_schema.mx_test_table'::regclass, 1310001, 't'::"char", '-1610612736', '-1073741825', false), ('mx_testing_schema.mx_test_table'::regclass, 1310002, 't'::"char", '-1073741824', '-536870913', false), ('mx_testing_schema.mx_test_table'::regclass, 1310003, 't'::"char", '-536870912', '-1', false), ('mx_testing_schema.mx_test_table'::regclass, 1310004, 't'::"char", '0', '536870911', false), ('mx_testing_schema.mx_test_table'::regclass, 1310005, 't'::"char", '536870912', '1073741823', false), ('mx_testing_schema.mx_test_table'::regclass, 1310006, 't'::"char", '1073741824', '1610612735', false), ('mx_testing_schema.mx_test_table'::regclass, 1310007, 't'::"char", '1610612736', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) FROM shard_data; + WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) AS (VALUES ('mx_testing_schema.mx_test_table'::regclass, 1310000, 't'::"char", '-2147483648', '-1610612737', false), ('mx_testing_schema.mx_test_table'::regclass, 1310001, 't'::"char", '-1610612736', '-1073741825', false), ('mx_testing_schema.mx_test_table'::regclass, 1310002, 't'::"char", '-1073741824', '-536870913', false), ('mx_testing_schema.mx_test_table'::regclass, 1310003, 't'::"char", '-536870912', '-1', false), ('mx_testing_schema.mx_test_table'::regclass, 1310004, 't'::"char", '0', '536870911', false), ('mx_testing_schema.mx_test_table'::regclass, 1310005, 't'::"char", '536870912', '1073741823', false), ('mx_testing_schema.mx_test_table'::regclass, 1310006, 't'::"char", '1073741824', '1610612735', false), ('mx_testing_schema.mx_test_table'::regclass, 1310007, 't'::"char", '1610612736', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) FROM shard_data; (54 rows) -- Show that range distributed tables are not included in the activate node snapshot @@ -447,7 +447,7 @@ SELECT unnest(activate_node_snapshot()) order by 1; WITH distributed_object_data(typetext, objnames, objargs, distargumentindex, colocationid, force_delegation) AS (VALUES ('sequence', ARRAY['public', 'user_defined_seq']::text[], ARRAY[]::text[], -1, 0, false)) SELECT citus_internal_add_object_metadata(typetext, objnames, objargs, distargumentindex::int, colocationid::int, force_delegation::bool) FROM distributed_object_data; WITH distributed_object_data(typetext, objnames, objargs, distargumentindex, colocationid, force_delegation) AS (VALUES ('table', ARRAY['mx_testing_schema', 'mx_test_table']::text[], ARRAY[]::text[], -1, 0, false)) SELECT citus_internal_add_object_metadata(typetext, objnames, objargs, distargumentindex::int, colocationid::int, force_delegation::bool) FROM distributed_object_data; WITH placement_data(shardid, shardlength, groupid, placementid) AS (VALUES (1310000, 0, 1, 100000), (1310001, 0, 2, 100001), (1310002, 0, 1, 100002), (1310003, 0, 2, 100003), (1310004, 0, 1, 100004), (1310005, 0, 2, 100005), (1310006, 0, 1, 100006), (1310007, 0, 2, 100007)) SELECT citus_internal_add_placement_metadata(shardid, shardlength, groupid, placementid) FROM placement_data; - WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) AS (VALUES ('mx_testing_schema.mx_test_table'::regclass, 1310000, 't'::"char", '-2147483648', '-1610612737', false), ('mx_testing_schema.mx_test_table'::regclass, 1310001, 't'::"char", '-1610612736', '-1073741825', false), ('mx_testing_schema.mx_test_table'::regclass, 1310002, 't'::"char", '-1073741824', '-536870913', false), ('mx_testing_schema.mx_test_table'::regclass, 1310003, 't'::"char", '-536870912', '-1', false), ('mx_testing_schema.mx_test_table'::regclass, 1310004, 't'::"char", '0', '536870911', false), ('mx_testing_schema.mx_test_table'::regclass, 1310005, 't'::"char", '536870912', '1073741823', false), ('mx_testing_schema.mx_test_table'::regclass, 1310006, 't'::"char", '1073741824', '1610612735', false), ('mx_testing_schema.mx_test_table'::regclass, 1310007, 't'::"char", '1610612736', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) FROM shard_data; + WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) AS (VALUES ('mx_testing_schema.mx_test_table'::regclass, 1310000, 't'::"char", '-2147483648', '-1610612737', false), ('mx_testing_schema.mx_test_table'::regclass, 1310001, 't'::"char", '-1610612736', '-1073741825', false), ('mx_testing_schema.mx_test_table'::regclass, 1310002, 't'::"char", '-1073741824', '-536870913', false), ('mx_testing_schema.mx_test_table'::regclass, 1310003, 't'::"char", '-536870912', '-1', false), ('mx_testing_schema.mx_test_table'::regclass, 1310004, 't'::"char", '0', '536870911', false), ('mx_testing_schema.mx_test_table'::regclass, 1310005, 't'::"char", '536870912', '1073741823', false), ('mx_testing_schema.mx_test_table'::regclass, 1310006, 't'::"char", '1073741824', '1610612735', false), ('mx_testing_schema.mx_test_table'::regclass, 1310007, 't'::"char", '1610612736', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) FROM shard_data; (54 rows) -- Test start_metadata_sync_to_node and citus_activate_node UDFs @@ -537,7 +537,7 @@ SELECT * FROM pg_dist_partition WHERE logicalrelid::text LIKE 'mx_testing_schema (1 row) SELECT * FROM pg_dist_shard WHERE logicalrelid::text LIKE 'mx_testing_schema%' ORDER BY shardid; - logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsisolatednode + logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsseparatenode --------------------------------------------------------------------- mx_testing_schema.mx_test_table | 1310000 | t | -2147483648 | -1610612737 | f mx_testing_schema.mx_test_table | 1310001 | t | -1610612736 | -1073741825 | f @@ -676,7 +676,7 @@ SELECT * FROM pg_dist_partition WHERE logicalrelid::text LIKE 'mx_testing_schema (1 row) SELECT * FROM pg_dist_shard WHERE logicalrelid::text LIKE 'mx_testing_schema%' ORDER BY shardid; - logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsisolatednode + logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsseparatenode --------------------------------------------------------------------- mx_testing_schema.mx_test_table | 1310000 | t | -2147483648 | -1610612737 | f mx_testing_schema.mx_test_table | 1310001 | t | -1610612736 | -1073741825 | f @@ -1021,7 +1021,7 @@ SELECT * FROM pg_dist_partition WHERE logicalrelid::text LIKE 'mx_test_schema%'; (0 rows) SELECT * FROM pg_dist_shard WHERE logicalrelid::text LIKE 'mx_test_schema%'; - logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsisolatednode + logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsseparatenode --------------------------------------------------------------------- (0 rows) @@ -1681,7 +1681,7 @@ SELECT "Column", "Type", "Definition" FROM index_attrs WHERE relid = 'mx_ref_index'::regclass; ERROR: relation "mx_ref_index" does not exist SELECT * FROM pg_dist_shard WHERE shardid=:ref_table_shardid; - logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsisolatednode + logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsseparatenode --------------------------------------------------------------------- (0 rows) @@ -2056,12 +2056,12 @@ SELECT unnest(activate_node_snapshot()) order by 1; WITH placement_data(shardid, shardlength, groupid, placementid) AS (VALUES (1310075, 0, 0, 100077), (1310075, 0, 1, 100078), (1310075, 0, 5, 100079)) SELECT citus_internal_add_placement_metadata(shardid, shardlength, groupid, placementid) FROM placement_data; WITH placement_data(shardid, shardlength, groupid, placementid) AS (VALUES (1310076, 0, 1, 100080), (1310077, 0, 5, 100081), (1310078, 0, 1, 100082), (1310079, 0, 5, 100083)) SELECT citus_internal_add_placement_metadata(shardid, shardlength, groupid, placementid) FROM placement_data; WITH placement_data(shardid, shardlength, groupid, placementid) AS (VALUES (1310085, 0, 1, 100091), (1310086, 0, 5, 100092), (1310087, 0, 1, 100093), (1310088, 0, 5, 100094)) SELECT citus_internal_add_placement_metadata(shardid, shardlength, groupid, placementid) FROM placement_data; - WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) AS (VALUES ('mx_test_schema_1.mx_table_1'::regclass, 1310022, 't'::"char", '-2147483648', '-1288490190', false), ('mx_test_schema_1.mx_table_1'::regclass, 1310023, 't'::"char", '-1288490189', '-429496731', false), ('mx_test_schema_1.mx_table_1'::regclass, 1310024, 't'::"char", '-429496730', '429496728', false), ('mx_test_schema_1.mx_table_1'::regclass, 1310025, 't'::"char", '429496729', '1288490187', false), ('mx_test_schema_1.mx_table_1'::regclass, 1310026, 't'::"char", '1288490188', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) FROM shard_data; - WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) AS (VALUES ('mx_test_schema_2.mx_table_2'::regclass, 1310027, 't'::"char", '-2147483648', '-1288490190', false), ('mx_test_schema_2.mx_table_2'::regclass, 1310028, 't'::"char", '-1288490189', '-429496731', false), ('mx_test_schema_2.mx_table_2'::regclass, 1310029, 't'::"char", '-429496730', '429496728', false), ('mx_test_schema_2.mx_table_2'::regclass, 1310030, 't'::"char", '429496729', '1288490187', false), ('mx_test_schema_2.mx_table_2'::regclass, 1310031, 't'::"char", '1288490188', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) FROM shard_data; - WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) AS (VALUES ('mx_testing_schema.mx_test_table'::regclass, 1310000, 't'::"char", '-2147483648', '-1610612737', false), ('mx_testing_schema.mx_test_table'::regclass, 1310001, 't'::"char", '-1610612736', '-1073741825', false), ('mx_testing_schema.mx_test_table'::regclass, 1310002, 't'::"char", '-1073741824', '-536870913', false), ('mx_testing_schema.mx_test_table'::regclass, 1310003, 't'::"char", '-536870912', '-1', false), ('mx_testing_schema.mx_test_table'::regclass, 1310004, 't'::"char", '0', '536870911', false), ('mx_testing_schema.mx_test_table'::regclass, 1310005, 't'::"char", '536870912', '1073741823', false), ('mx_testing_schema.mx_test_table'::regclass, 1310006, 't'::"char", '1073741824', '1610612735', false), ('mx_testing_schema.mx_test_table'::regclass, 1310007, 't'::"char", '1610612736', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) FROM shard_data; - WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) AS (VALUES ('public.dist_table_1'::regclass, 1310076, 't'::"char", '-2147483648', '-1073741825', false), ('public.dist_table_1'::regclass, 1310077, 't'::"char", '-1073741824', '-1', false), ('public.dist_table_1'::regclass, 1310078, 't'::"char", '0', '1073741823', false), ('public.dist_table_1'::regclass, 1310079, 't'::"char", '1073741824', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) FROM shard_data; - WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) AS (VALUES ('public.mx_ref'::regclass, 1310075, 't'::"char", NULL, NULL, false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) FROM shard_data; - WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) AS (VALUES ('public.test_table'::regclass, 1310085, 't'::"char", '-2147483648', '-1073741825', false), ('public.test_table'::regclass, 1310086, 't'::"char", '-1073741824', '-1', false), ('public.test_table'::regclass, 1310087, 't'::"char", '0', '1073741823', false), ('public.test_table'::regclass, 1310088, 't'::"char", '1073741824', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) FROM shard_data; + WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) AS (VALUES ('mx_test_schema_1.mx_table_1'::regclass, 1310022, 't'::"char", '-2147483648', '-1288490190', false), ('mx_test_schema_1.mx_table_1'::regclass, 1310023, 't'::"char", '-1288490189', '-429496731', false), ('mx_test_schema_1.mx_table_1'::regclass, 1310024, 't'::"char", '-429496730', '429496728', false), ('mx_test_schema_1.mx_table_1'::regclass, 1310025, 't'::"char", '429496729', '1288490187', false), ('mx_test_schema_1.mx_table_1'::regclass, 1310026, 't'::"char", '1288490188', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) FROM shard_data; + WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) AS (VALUES ('mx_test_schema_2.mx_table_2'::regclass, 1310027, 't'::"char", '-2147483648', '-1288490190', false), ('mx_test_schema_2.mx_table_2'::regclass, 1310028, 't'::"char", '-1288490189', '-429496731', false), ('mx_test_schema_2.mx_table_2'::regclass, 1310029, 't'::"char", '-429496730', '429496728', false), ('mx_test_schema_2.mx_table_2'::regclass, 1310030, 't'::"char", '429496729', '1288490187', false), ('mx_test_schema_2.mx_table_2'::regclass, 1310031, 't'::"char", '1288490188', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) FROM shard_data; + WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) AS (VALUES ('mx_testing_schema.mx_test_table'::regclass, 1310000, 't'::"char", '-2147483648', '-1610612737', false), ('mx_testing_schema.mx_test_table'::regclass, 1310001, 't'::"char", '-1610612736', '-1073741825', false), ('mx_testing_schema.mx_test_table'::regclass, 1310002, 't'::"char", '-1073741824', '-536870913', false), ('mx_testing_schema.mx_test_table'::regclass, 1310003, 't'::"char", '-536870912', '-1', false), ('mx_testing_schema.mx_test_table'::regclass, 1310004, 't'::"char", '0', '536870911', false), ('mx_testing_schema.mx_test_table'::regclass, 1310005, 't'::"char", '536870912', '1073741823', false), ('mx_testing_schema.mx_test_table'::regclass, 1310006, 't'::"char", '1073741824', '1610612735', false), ('mx_testing_schema.mx_test_table'::regclass, 1310007, 't'::"char", '1610612736', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) FROM shard_data; + WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) AS (VALUES ('public.dist_table_1'::regclass, 1310076, 't'::"char", '-2147483648', '-1073741825', false), ('public.dist_table_1'::regclass, 1310077, 't'::"char", '-1073741824', '-1', false), ('public.dist_table_1'::regclass, 1310078, 't'::"char", '0', '1073741823', false), ('public.dist_table_1'::regclass, 1310079, 't'::"char", '1073741824', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) FROM shard_data; + WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) AS (VALUES ('public.mx_ref'::regclass, 1310075, 't'::"char", NULL, NULL, false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) FROM shard_data; + WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) AS (VALUES ('public.test_table'::regclass, 1310085, 't'::"char", '-2147483648', '-1073741825', false), ('public.test_table'::regclass, 1310086, 't'::"char", '-1073741824', '-1', false), ('public.test_table'::regclass, 1310087, 't'::"char", '0', '1073741823', false), ('public.test_table'::regclass, 1310088, 't'::"char", '1073741824', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) FROM shard_data; (118 rows) -- shouldn't work since test_table is MX diff --git a/src/test/regress/expected/multi_metadata_sync_0.out b/src/test/regress/expected/multi_metadata_sync_0.out index 3334cdc5b..3f22815b9 100644 --- a/src/test/regress/expected/multi_metadata_sync_0.out +++ b/src/test/regress/expected/multi_metadata_sync_0.out @@ -194,8 +194,8 @@ SELECT unnest(activate_node_snapshot()) order by 1; WITH distributed_object_data(typetext, objnames, objargs, distargumentindex, colocationid, force_delegation) AS (VALUES ('table', ARRAY['public', 'single_shard_tbl']::text[], ARRAY[]::text[], -1, 0, false)) SELECT citus_internal_add_object_metadata(typetext, objnames, objargs, distargumentindex::int, colocationid::int, force_delegation::bool) FROM distributed_object_data; WITH placement_data(shardid, shardlength, groupid, placementid) AS (VALUES (1310000, 0, 1, 100000), (1310001, 0, 2, 100001), (1310002, 0, 1, 100002), (1310003, 0, 2, 100003), (1310004, 0, 1, 100004), (1310005, 0, 2, 100005), (1310006, 0, 1, 100006), (1310007, 0, 2, 100007)) SELECT citus_internal_add_placement_metadata(shardid, shardlength, groupid, placementid) FROM placement_data; WITH placement_data(shardid, shardlength, groupid, placementid) AS (VALUES (1310008, 0, 2, 100008)) SELECT citus_internal_add_placement_metadata(shardid, shardlength, groupid, placementid) FROM placement_data; - WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) AS (VALUES ('public.mx_test_table'::regclass, 1310000, 't'::"char", '-2147483648', '-1610612737', false), ('public.mx_test_table'::regclass, 1310001, 't'::"char", '-1610612736', '-1073741825', false), ('public.mx_test_table'::regclass, 1310002, 't'::"char", '-1073741824', '-536870913', false), ('public.mx_test_table'::regclass, 1310003, 't'::"char", '-536870912', '-1', false), ('public.mx_test_table'::regclass, 1310004, 't'::"char", '0', '536870911', false), ('public.mx_test_table'::regclass, 1310005, 't'::"char", '536870912', '1073741823', false), ('public.mx_test_table'::regclass, 1310006, 't'::"char", '1073741824', '1610612735', false), ('public.mx_test_table'::regclass, 1310007, 't'::"char", '1610612736', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) FROM shard_data; - WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) AS (VALUES ('public.single_shard_tbl'::regclass, 1310008, 't'::"char", NULL, NULL, false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) FROM shard_data; + WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) AS (VALUES ('public.mx_test_table'::regclass, 1310000, 't'::"char", '-2147483648', '-1610612737', false), ('public.mx_test_table'::regclass, 1310001, 't'::"char", '-1610612736', '-1073741825', false), ('public.mx_test_table'::regclass, 1310002, 't'::"char", '-1073741824', '-536870913', false), ('public.mx_test_table'::regclass, 1310003, 't'::"char", '-536870912', '-1', false), ('public.mx_test_table'::regclass, 1310004, 't'::"char", '0', '536870911', false), ('public.mx_test_table'::regclass, 1310005, 't'::"char", '536870912', '1073741823', false), ('public.mx_test_table'::regclass, 1310006, 't'::"char", '1073741824', '1610612735', false), ('public.mx_test_table'::regclass, 1310007, 't'::"char", '1610612736', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) FROM shard_data; + WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) AS (VALUES ('public.single_shard_tbl'::regclass, 1310008, 't'::"char", NULL, NULL, false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) FROM shard_data; (61 rows) -- Drop single shard table @@ -256,7 +256,7 @@ SELECT unnest(activate_node_snapshot()) order by 1; WITH distributed_object_data(typetext, objnames, objargs, distargumentindex, colocationid, force_delegation) AS (VALUES ('sequence', ARRAY['public', 'user_defined_seq']::text[], ARRAY[]::text[], -1, 0, false)) SELECT citus_internal_add_object_metadata(typetext, objnames, objargs, distargumentindex::int, colocationid::int, force_delegation::bool) FROM distributed_object_data; WITH distributed_object_data(typetext, objnames, objargs, distargumentindex, colocationid, force_delegation) AS (VALUES ('table', ARRAY['public', 'mx_test_table']::text[], ARRAY[]::text[], -1, 0, false)) SELECT citus_internal_add_object_metadata(typetext, objnames, objargs, distargumentindex::int, colocationid::int, force_delegation::bool) FROM distributed_object_data; WITH placement_data(shardid, shardlength, groupid, placementid) AS (VALUES (1310000, 0, 1, 100000), (1310001, 0, 2, 100001), (1310002, 0, 1, 100002), (1310003, 0, 2, 100003), (1310004, 0, 1, 100004), (1310005, 0, 2, 100005), (1310006, 0, 1, 100006), (1310007, 0, 2, 100007)) SELECT citus_internal_add_placement_metadata(shardid, shardlength, groupid, placementid) FROM placement_data; - WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) AS (VALUES ('public.mx_test_table'::regclass, 1310000, 't'::"char", '-2147483648', '-1610612737', false), ('public.mx_test_table'::regclass, 1310001, 't'::"char", '-1610612736', '-1073741825', false), ('public.mx_test_table'::regclass, 1310002, 't'::"char", '-1073741824', '-536870913', false), ('public.mx_test_table'::regclass, 1310003, 't'::"char", '-536870912', '-1', false), ('public.mx_test_table'::regclass, 1310004, 't'::"char", '0', '536870911', false), ('public.mx_test_table'::regclass, 1310005, 't'::"char", '536870912', '1073741823', false), ('public.mx_test_table'::regclass, 1310006, 't'::"char", '1073741824', '1610612735', false), ('public.mx_test_table'::regclass, 1310007, 't'::"char", '1610612736', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) FROM shard_data; + WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) AS (VALUES ('public.mx_test_table'::regclass, 1310000, 't'::"char", '-2147483648', '-1610612737', false), ('public.mx_test_table'::regclass, 1310001, 't'::"char", '-1610612736', '-1073741825', false), ('public.mx_test_table'::regclass, 1310002, 't'::"char", '-1073741824', '-536870913', false), ('public.mx_test_table'::regclass, 1310003, 't'::"char", '-536870912', '-1', false), ('public.mx_test_table'::regclass, 1310004, 't'::"char", '0', '536870911', false), ('public.mx_test_table'::regclass, 1310005, 't'::"char", '536870912', '1073741823', false), ('public.mx_test_table'::regclass, 1310006, 't'::"char", '1073741824', '1610612735', false), ('public.mx_test_table'::regclass, 1310007, 't'::"char", '1610612736', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) FROM shard_data; (52 rows) -- Show that schema changes are included in the activate node snapshot @@ -318,7 +318,7 @@ SELECT unnest(activate_node_snapshot()) order by 1; WITH distributed_object_data(typetext, objnames, objargs, distargumentindex, colocationid, force_delegation) AS (VALUES ('sequence', ARRAY['public', 'user_defined_seq']::text[], ARRAY[]::text[], -1, 0, false)) SELECT citus_internal_add_object_metadata(typetext, objnames, objargs, distargumentindex::int, colocationid::int, force_delegation::bool) FROM distributed_object_data; WITH distributed_object_data(typetext, objnames, objargs, distargumentindex, colocationid, force_delegation) AS (VALUES ('table', ARRAY['mx_testing_schema', 'mx_test_table']::text[], ARRAY[]::text[], -1, 0, false)) SELECT citus_internal_add_object_metadata(typetext, objnames, objargs, distargumentindex::int, colocationid::int, force_delegation::bool) FROM distributed_object_data; WITH placement_data(shardid, shardlength, groupid, placementid) AS (VALUES (1310000, 0, 1, 100000), (1310001, 0, 2, 100001), (1310002, 0, 1, 100002), (1310003, 0, 2, 100003), (1310004, 0, 1, 100004), (1310005, 0, 2, 100005), (1310006, 0, 1, 100006), (1310007, 0, 2, 100007)) SELECT citus_internal_add_placement_metadata(shardid, shardlength, groupid, placementid) FROM placement_data; - WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) AS (VALUES ('mx_testing_schema.mx_test_table'::regclass, 1310000, 't'::"char", '-2147483648', '-1610612737', false), ('mx_testing_schema.mx_test_table'::regclass, 1310001, 't'::"char", '-1610612736', '-1073741825', false), ('mx_testing_schema.mx_test_table'::regclass, 1310002, 't'::"char", '-1073741824', '-536870913', false), ('mx_testing_schema.mx_test_table'::regclass, 1310003, 't'::"char", '-536870912', '-1', false), ('mx_testing_schema.mx_test_table'::regclass, 1310004, 't'::"char", '0', '536870911', false), ('mx_testing_schema.mx_test_table'::regclass, 1310005, 't'::"char", '536870912', '1073741823', false), ('mx_testing_schema.mx_test_table'::regclass, 1310006, 't'::"char", '1073741824', '1610612735', false), ('mx_testing_schema.mx_test_table'::regclass, 1310007, 't'::"char", '1610612736', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) FROM shard_data; + WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) AS (VALUES ('mx_testing_schema.mx_test_table'::regclass, 1310000, 't'::"char", '-2147483648', '-1610612737', false), ('mx_testing_schema.mx_test_table'::regclass, 1310001, 't'::"char", '-1610612736', '-1073741825', false), ('mx_testing_schema.mx_test_table'::regclass, 1310002, 't'::"char", '-1073741824', '-536870913', false), ('mx_testing_schema.mx_test_table'::regclass, 1310003, 't'::"char", '-536870912', '-1', false), ('mx_testing_schema.mx_test_table'::regclass, 1310004, 't'::"char", '0', '536870911', false), ('mx_testing_schema.mx_test_table'::regclass, 1310005, 't'::"char", '536870912', '1073741823', false), ('mx_testing_schema.mx_test_table'::regclass, 1310006, 't'::"char", '1073741824', '1610612735', false), ('mx_testing_schema.mx_test_table'::regclass, 1310007, 't'::"char", '1610612736', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) FROM shard_data; (54 rows) -- Show that append distributed tables are not included in the activate node snapshot @@ -386,7 +386,7 @@ SELECT unnest(activate_node_snapshot()) order by 1; WITH distributed_object_data(typetext, objnames, objargs, distargumentindex, colocationid, force_delegation) AS (VALUES ('sequence', ARRAY['public', 'user_defined_seq']::text[], ARRAY[]::text[], -1, 0, false)) SELECT citus_internal_add_object_metadata(typetext, objnames, objargs, distargumentindex::int, colocationid::int, force_delegation::bool) FROM distributed_object_data; WITH distributed_object_data(typetext, objnames, objargs, distargumentindex, colocationid, force_delegation) AS (VALUES ('table', ARRAY['mx_testing_schema', 'mx_test_table']::text[], ARRAY[]::text[], -1, 0, false)) SELECT citus_internal_add_object_metadata(typetext, objnames, objargs, distargumentindex::int, colocationid::int, force_delegation::bool) FROM distributed_object_data; WITH placement_data(shardid, shardlength, groupid, placementid) AS (VALUES (1310000, 0, 1, 100000), (1310001, 0, 2, 100001), (1310002, 0, 1, 100002), (1310003, 0, 2, 100003), (1310004, 0, 1, 100004), (1310005, 0, 2, 100005), (1310006, 0, 1, 100006), (1310007, 0, 2, 100007)) SELECT citus_internal_add_placement_metadata(shardid, shardlength, groupid, placementid) FROM placement_data; - WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) AS (VALUES ('mx_testing_schema.mx_test_table'::regclass, 1310000, 't'::"char", '-2147483648', '-1610612737', false), ('mx_testing_schema.mx_test_table'::regclass, 1310001, 't'::"char", '-1610612736', '-1073741825', false), ('mx_testing_schema.mx_test_table'::regclass, 1310002, 't'::"char", '-1073741824', '-536870913', false), ('mx_testing_schema.mx_test_table'::regclass, 1310003, 't'::"char", '-536870912', '-1', false), ('mx_testing_schema.mx_test_table'::regclass, 1310004, 't'::"char", '0', '536870911', false), ('mx_testing_schema.mx_test_table'::regclass, 1310005, 't'::"char", '536870912', '1073741823', false), ('mx_testing_schema.mx_test_table'::regclass, 1310006, 't'::"char", '1073741824', '1610612735', false), ('mx_testing_schema.mx_test_table'::regclass, 1310007, 't'::"char", '1610612736', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) FROM shard_data; + WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) AS (VALUES ('mx_testing_schema.mx_test_table'::regclass, 1310000, 't'::"char", '-2147483648', '-1610612737', false), ('mx_testing_schema.mx_test_table'::regclass, 1310001, 't'::"char", '-1610612736', '-1073741825', false), ('mx_testing_schema.mx_test_table'::regclass, 1310002, 't'::"char", '-1073741824', '-536870913', false), ('mx_testing_schema.mx_test_table'::regclass, 1310003, 't'::"char", '-536870912', '-1', false), ('mx_testing_schema.mx_test_table'::regclass, 1310004, 't'::"char", '0', '536870911', false), ('mx_testing_schema.mx_test_table'::regclass, 1310005, 't'::"char", '536870912', '1073741823', false), ('mx_testing_schema.mx_test_table'::regclass, 1310006, 't'::"char", '1073741824', '1610612735', false), ('mx_testing_schema.mx_test_table'::regclass, 1310007, 't'::"char", '1610612736', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) FROM shard_data; (54 rows) -- Show that range distributed tables are not included in the activate node snapshot @@ -447,7 +447,7 @@ SELECT unnest(activate_node_snapshot()) order by 1; WITH distributed_object_data(typetext, objnames, objargs, distargumentindex, colocationid, force_delegation) AS (VALUES ('sequence', ARRAY['public', 'user_defined_seq']::text[], ARRAY[]::text[], -1, 0, false)) SELECT citus_internal_add_object_metadata(typetext, objnames, objargs, distargumentindex::int, colocationid::int, force_delegation::bool) FROM distributed_object_data; WITH distributed_object_data(typetext, objnames, objargs, distargumentindex, colocationid, force_delegation) AS (VALUES ('table', ARRAY['mx_testing_schema', 'mx_test_table']::text[], ARRAY[]::text[], -1, 0, false)) SELECT citus_internal_add_object_metadata(typetext, objnames, objargs, distargumentindex::int, colocationid::int, force_delegation::bool) FROM distributed_object_data; WITH placement_data(shardid, shardlength, groupid, placementid) AS (VALUES (1310000, 0, 1, 100000), (1310001, 0, 2, 100001), (1310002, 0, 1, 100002), (1310003, 0, 2, 100003), (1310004, 0, 1, 100004), (1310005, 0, 2, 100005), (1310006, 0, 1, 100006), (1310007, 0, 2, 100007)) SELECT citus_internal_add_placement_metadata(shardid, shardlength, groupid, placementid) FROM placement_data; - WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) AS (VALUES ('mx_testing_schema.mx_test_table'::regclass, 1310000, 't'::"char", '-2147483648', '-1610612737', false), ('mx_testing_schema.mx_test_table'::regclass, 1310001, 't'::"char", '-1610612736', '-1073741825', false), ('mx_testing_schema.mx_test_table'::regclass, 1310002, 't'::"char", '-1073741824', '-536870913', false), ('mx_testing_schema.mx_test_table'::regclass, 1310003, 't'::"char", '-536870912', '-1', false), ('mx_testing_schema.mx_test_table'::regclass, 1310004, 't'::"char", '0', '536870911', false), ('mx_testing_schema.mx_test_table'::regclass, 1310005, 't'::"char", '536870912', '1073741823', false), ('mx_testing_schema.mx_test_table'::regclass, 1310006, 't'::"char", '1073741824', '1610612735', false), ('mx_testing_schema.mx_test_table'::regclass, 1310007, 't'::"char", '1610612736', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) FROM shard_data; + WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) AS (VALUES ('mx_testing_schema.mx_test_table'::regclass, 1310000, 't'::"char", '-2147483648', '-1610612737', false), ('mx_testing_schema.mx_test_table'::regclass, 1310001, 't'::"char", '-1610612736', '-1073741825', false), ('mx_testing_schema.mx_test_table'::regclass, 1310002, 't'::"char", '-1073741824', '-536870913', false), ('mx_testing_schema.mx_test_table'::regclass, 1310003, 't'::"char", '-536870912', '-1', false), ('mx_testing_schema.mx_test_table'::regclass, 1310004, 't'::"char", '0', '536870911', false), ('mx_testing_schema.mx_test_table'::regclass, 1310005, 't'::"char", '536870912', '1073741823', false), ('mx_testing_schema.mx_test_table'::regclass, 1310006, 't'::"char", '1073741824', '1610612735', false), ('mx_testing_schema.mx_test_table'::regclass, 1310007, 't'::"char", '1610612736', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) FROM shard_data; (54 rows) -- Test start_metadata_sync_to_node and citus_activate_node UDFs @@ -537,7 +537,7 @@ SELECT * FROM pg_dist_partition WHERE logicalrelid::text LIKE 'mx_testing_schema (1 row) SELECT * FROM pg_dist_shard WHERE logicalrelid::text LIKE 'mx_testing_schema%' ORDER BY shardid; - logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsisolatednode + logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsseparatenode --------------------------------------------------------------------- mx_testing_schema.mx_test_table | 1310000 | t | -2147483648 | -1610612737 | f mx_testing_schema.mx_test_table | 1310001 | t | -1610612736 | -1073741825 | f @@ -676,7 +676,7 @@ SELECT * FROM pg_dist_partition WHERE logicalrelid::text LIKE 'mx_testing_schema (1 row) SELECT * FROM pg_dist_shard WHERE logicalrelid::text LIKE 'mx_testing_schema%' ORDER BY shardid; - logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsisolatednode + logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsseparatenode --------------------------------------------------------------------- mx_testing_schema.mx_test_table | 1310000 | t | -2147483648 | -1610612737 | f mx_testing_schema.mx_test_table | 1310001 | t | -1610612736 | -1073741825 | f @@ -1021,7 +1021,7 @@ SELECT * FROM pg_dist_partition WHERE logicalrelid::text LIKE 'mx_test_schema%'; (0 rows) SELECT * FROM pg_dist_shard WHERE logicalrelid::text LIKE 'mx_test_schema%'; - logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsisolatednode + logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsseparatenode --------------------------------------------------------------------- (0 rows) @@ -1681,7 +1681,7 @@ SELECT "Column", "Type", "Definition" FROM index_attrs WHERE relid = 'mx_ref_index'::regclass; ERROR: relation "mx_ref_index" does not exist SELECT * FROM pg_dist_shard WHERE shardid=:ref_table_shardid; - logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsisolatednode + logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsseparatenode --------------------------------------------------------------------- (0 rows) @@ -2056,12 +2056,12 @@ SELECT unnest(activate_node_snapshot()) order by 1; WITH placement_data(shardid, shardlength, groupid, placementid) AS (VALUES (1310075, 0, 0, 100077), (1310075, 0, 1, 100078), (1310075, 0, 5, 100079)) SELECT citus_internal_add_placement_metadata(shardid, shardlength, groupid, placementid) FROM placement_data; WITH placement_data(shardid, shardlength, groupid, placementid) AS (VALUES (1310076, 0, 1, 100080), (1310077, 0, 5, 100081), (1310078, 0, 1, 100082), (1310079, 0, 5, 100083)) SELECT citus_internal_add_placement_metadata(shardid, shardlength, groupid, placementid) FROM placement_data; WITH placement_data(shardid, shardlength, groupid, placementid) AS (VALUES (1310085, 0, 1, 100091), (1310086, 0, 5, 100092), (1310087, 0, 1, 100093), (1310088, 0, 5, 100094)) SELECT citus_internal_add_placement_metadata(shardid, shardlength, groupid, placementid) FROM placement_data; - WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) AS (VALUES ('mx_test_schema_1.mx_table_1'::regclass, 1310022, 't'::"char", '-2147483648', '-1288490190', false), ('mx_test_schema_1.mx_table_1'::regclass, 1310023, 't'::"char", '-1288490189', '-429496731', false), ('mx_test_schema_1.mx_table_1'::regclass, 1310024, 't'::"char", '-429496730', '429496728', false), ('mx_test_schema_1.mx_table_1'::regclass, 1310025, 't'::"char", '429496729', '1288490187', false), ('mx_test_schema_1.mx_table_1'::regclass, 1310026, 't'::"char", '1288490188', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) FROM shard_data; - WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) AS (VALUES ('mx_test_schema_2.mx_table_2'::regclass, 1310027, 't'::"char", '-2147483648', '-1288490190', false), ('mx_test_schema_2.mx_table_2'::regclass, 1310028, 't'::"char", '-1288490189', '-429496731', false), ('mx_test_schema_2.mx_table_2'::regclass, 1310029, 't'::"char", '-429496730', '429496728', false), ('mx_test_schema_2.mx_table_2'::regclass, 1310030, 't'::"char", '429496729', '1288490187', false), ('mx_test_schema_2.mx_table_2'::regclass, 1310031, 't'::"char", '1288490188', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) FROM shard_data; - WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) AS (VALUES ('mx_testing_schema.mx_test_table'::regclass, 1310000, 't'::"char", '-2147483648', '-1610612737', false), ('mx_testing_schema.mx_test_table'::regclass, 1310001, 't'::"char", '-1610612736', '-1073741825', false), ('mx_testing_schema.mx_test_table'::regclass, 1310002, 't'::"char", '-1073741824', '-536870913', false), ('mx_testing_schema.mx_test_table'::regclass, 1310003, 't'::"char", '-536870912', '-1', false), ('mx_testing_schema.mx_test_table'::regclass, 1310004, 't'::"char", '0', '536870911', false), ('mx_testing_schema.mx_test_table'::regclass, 1310005, 't'::"char", '536870912', '1073741823', false), ('mx_testing_schema.mx_test_table'::regclass, 1310006, 't'::"char", '1073741824', '1610612735', false), ('mx_testing_schema.mx_test_table'::regclass, 1310007, 't'::"char", '1610612736', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) FROM shard_data; - WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) AS (VALUES ('public.dist_table_1'::regclass, 1310076, 't'::"char", '-2147483648', '-1073741825', false), ('public.dist_table_1'::regclass, 1310077, 't'::"char", '-1073741824', '-1', false), ('public.dist_table_1'::regclass, 1310078, 't'::"char", '0', '1073741823', false), ('public.dist_table_1'::regclass, 1310079, 't'::"char", '1073741824', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) FROM shard_data; - WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) AS (VALUES ('public.mx_ref'::regclass, 1310075, 't'::"char", NULL, NULL, false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) FROM shard_data; - WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) AS (VALUES ('public.test_table'::regclass, 1310085, 't'::"char", '-2147483648', '-1073741825', false), ('public.test_table'::regclass, 1310086, 't'::"char", '-1073741824', '-1', false), ('public.test_table'::regclass, 1310087, 't'::"char", '0', '1073741823', false), ('public.test_table'::regclass, 1310088, 't'::"char", '1073741824', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsisolatednode) FROM shard_data; + WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) AS (VALUES ('mx_test_schema_1.mx_table_1'::regclass, 1310022, 't'::"char", '-2147483648', '-1288490190', false), ('mx_test_schema_1.mx_table_1'::regclass, 1310023, 't'::"char", '-1288490189', '-429496731', false), ('mx_test_schema_1.mx_table_1'::regclass, 1310024, 't'::"char", '-429496730', '429496728', false), ('mx_test_schema_1.mx_table_1'::regclass, 1310025, 't'::"char", '429496729', '1288490187', false), ('mx_test_schema_1.mx_table_1'::regclass, 1310026, 't'::"char", '1288490188', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) FROM shard_data; + WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) AS (VALUES ('mx_test_schema_2.mx_table_2'::regclass, 1310027, 't'::"char", '-2147483648', '-1288490190', false), ('mx_test_schema_2.mx_table_2'::regclass, 1310028, 't'::"char", '-1288490189', '-429496731', false), ('mx_test_schema_2.mx_table_2'::regclass, 1310029, 't'::"char", '-429496730', '429496728', false), ('mx_test_schema_2.mx_table_2'::regclass, 1310030, 't'::"char", '429496729', '1288490187', false), ('mx_test_schema_2.mx_table_2'::regclass, 1310031, 't'::"char", '1288490188', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) FROM shard_data; + WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) AS (VALUES ('mx_testing_schema.mx_test_table'::regclass, 1310000, 't'::"char", '-2147483648', '-1610612737', false), ('mx_testing_schema.mx_test_table'::regclass, 1310001, 't'::"char", '-1610612736', '-1073741825', false), ('mx_testing_schema.mx_test_table'::regclass, 1310002, 't'::"char", '-1073741824', '-536870913', false), ('mx_testing_schema.mx_test_table'::regclass, 1310003, 't'::"char", '-536870912', '-1', false), ('mx_testing_schema.mx_test_table'::regclass, 1310004, 't'::"char", '0', '536870911', false), ('mx_testing_schema.mx_test_table'::regclass, 1310005, 't'::"char", '536870912', '1073741823', false), ('mx_testing_schema.mx_test_table'::regclass, 1310006, 't'::"char", '1073741824', '1610612735', false), ('mx_testing_schema.mx_test_table'::regclass, 1310007, 't'::"char", '1610612736', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) FROM shard_data; + WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) AS (VALUES ('public.dist_table_1'::regclass, 1310076, 't'::"char", '-2147483648', '-1073741825', false), ('public.dist_table_1'::regclass, 1310077, 't'::"char", '-1073741824', '-1', false), ('public.dist_table_1'::regclass, 1310078, 't'::"char", '0', '1073741823', false), ('public.dist_table_1'::regclass, 1310079, 't'::"char", '1073741824', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) FROM shard_data; + WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) AS (VALUES ('public.mx_ref'::regclass, 1310075, 't'::"char", NULL, NULL, false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) FROM shard_data; + WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) AS (VALUES ('public.test_table'::regclass, 1310085, 't'::"char", '-2147483648', '-1073741825', false), ('public.test_table'::regclass, 1310086, 't'::"char", '-1073741824', '-1', false), ('public.test_table'::regclass, 1310087, 't'::"char", '0', '1073741823', false), ('public.test_table'::regclass, 1310088, 't'::"char", '1073741824', '2147483647', false)) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue, needsseparatenode) FROM shard_data; (118 rows) -- shouldn't work since test_table is MX diff --git a/src/test/regress/expected/multi_row_insert.out b/src/test/regress/expected/multi_row_insert.out index da9c73ff6..3b49f1625 100644 --- a/src/test/regress/expected/multi_row_insert.out +++ b/src/test/regress/expected/multi_row_insert.out @@ -12,7 +12,7 @@ SELECT create_distributed_table('source_table_xyz', 'key', 'range'); CALL public.create_range_partitioned_shards('source_table_xyz', '{"(0,a)","(25,z)"}','{"(24,a)","(49,z)"}'); SELECT * FROM pg_dist_shard WHERE logicalrelid='source_table_xyz'::regclass::oid ORDER BY shardid; - logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsisolatednode + logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsseparatenode --------------------------------------------------------------------- source_table_xyz | 4213581 | t | (0,a) | (24,a) | f source_table_xyz | 4213582 | t | (25,z) | (49,z) | f diff --git a/src/test/regress/expected/multi_table_ddl.out b/src/test/regress/expected/multi_table_ddl.out index 9fa53faef..f4997697c 100644 --- a/src/test/regress/expected/multi_table_ddl.out +++ b/src/test/regress/expected/multi_table_ddl.out @@ -65,7 +65,7 @@ SELECT * FROM pg_dist_partition; (0 rows) SELECT * FROM pg_dist_shard; - logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsisolatednode + logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsseparatenode --------------------------------------------------------------------- (0 rows) diff --git a/src/test/regress/expected/multi_tenant_isolation.out b/src/test/regress/expected/multi_tenant_isolation.out index b3310e4c7..eaf3def80 100644 --- a/src/test/regress/expected/multi_tenant_isolation.out +++ b/src/test/regress/expected/multi_tenant_isolation.out @@ -168,7 +168,7 @@ SELECT count(*) FROM orders_streaming WHERE o_orderkey = 103; SELECT * FROM pg_dist_shard WHERE logicalrelid = 'lineitem_streaming'::regclass OR logicalrelid = 'orders_streaming'::regclass ORDER BY shardminvalue::BIGINT, logicalrelid; - logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsisolatednode + logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsseparatenode --------------------------------------------------------------------- lineitem_streaming | 1230000 | t | -2147483648 | -1 | f orders_streaming | 1230002 | t | -2147483648 | -1 | f @@ -387,7 +387,7 @@ SELECT count(*) FROM orders_streaming WHERE o_orderkey = 103; SELECT * FROM pg_dist_shard WHERE logicalrelid = 'lineitem_streaming'::regclass OR logicalrelid = 'orders_streaming'::regclass ORDER BY shardminvalue::BIGINT, logicalrelid; - logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsisolatednode + logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsseparatenode --------------------------------------------------------------------- lineitem_streaming | 1230040 | t | -2147483648 | -2147483648 | f orders_streaming | 1230042 | t | -2147483648 | -2147483648 | f @@ -541,7 +541,7 @@ SET search_path to "Tenant Isolation"; SELECT * FROM pg_dist_shard WHERE logicalrelid = 'lineitem_streaming'::regclass OR logicalrelid = 'orders_streaming'::regclass ORDER BY shardminvalue::BIGINT, logicalrelid; - logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsisolatednode + logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsseparatenode --------------------------------------------------------------------- lineitem_streaming | 1230040 | t | -2147483648 | -2147483648 | f orders_streaming | 1230042 | t | -2147483648 | -2147483648 | f @@ -684,7 +684,7 @@ ERROR: cannot isolate tenant because tenant isolation is only support for hash SELECT * FROM pg_dist_shard WHERE logicalrelid = 'lineitem_streaming'::regclass OR logicalrelid = 'orders_streaming'::regclass ORDER BY shardminvalue::BIGINT, logicalrelid; - logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsisolatednode + logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsseparatenode --------------------------------------------------------------------- lineitem_streaming | 1230040 | t | -2147483648 | -2147483648 | f orders_streaming | 1230042 | t | -2147483648 | -2147483648 | f diff --git a/src/test/regress/expected/multi_tenant_isolation_nonblocking.out b/src/test/regress/expected/multi_tenant_isolation_nonblocking.out index 3e6506c21..a310d8139 100644 --- a/src/test/regress/expected/multi_tenant_isolation_nonblocking.out +++ b/src/test/regress/expected/multi_tenant_isolation_nonblocking.out @@ -168,7 +168,7 @@ SELECT count(*) FROM orders_streaming WHERE o_orderkey = 103; SELECT * FROM pg_dist_shard WHERE logicalrelid = 'lineitem_streaming'::regclass OR logicalrelid = 'orders_streaming'::regclass ORDER BY shardminvalue::BIGINT, logicalrelid; - logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsisolatednode + logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsseparatenode --------------------------------------------------------------------- lineitem_streaming | 1230000 | t | -2147483648 | -1 | f orders_streaming | 1230002 | t | -2147483648 | -1 | f @@ -399,7 +399,7 @@ SELECT count(*) FROM orders_streaming WHERE o_orderkey = 103; SELECT * FROM pg_dist_shard WHERE logicalrelid = 'lineitem_streaming'::regclass OR logicalrelid = 'orders_streaming'::regclass ORDER BY shardminvalue::BIGINT, logicalrelid; - logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsisolatednode + logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsseparatenode --------------------------------------------------------------------- lineitem_streaming | 1230040 | t | -2147483648 | -2147483648 | f orders_streaming | 1230042 | t | -2147483648 | -2147483648 | f @@ -553,7 +553,7 @@ SET search_path to "Tenant Isolation"; SELECT * FROM pg_dist_shard WHERE logicalrelid = 'lineitem_streaming'::regclass OR logicalrelid = 'orders_streaming'::regclass ORDER BY shardminvalue::BIGINT, logicalrelid; - logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsisolatednode + logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsseparatenode --------------------------------------------------------------------- lineitem_streaming | 1230040 | t | -2147483648 | -2147483648 | f orders_streaming | 1230042 | t | -2147483648 | -2147483648 | f @@ -728,7 +728,7 @@ ERROR: cannot isolate tenant because tenant isolation is only support for hash SELECT * FROM pg_dist_shard WHERE logicalrelid = 'lineitem_streaming'::regclass OR logicalrelid = 'orders_streaming'::regclass ORDER BY shardminvalue::BIGINT, logicalrelid; - logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsisolatednode + logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | needsseparatenode --------------------------------------------------------------------- lineitem_streaming | 1230040 | t | -2147483648 | -2147483648 | f orders_streaming | 1230042 | t | -2147483648 | -2147483648 | f diff --git a/src/test/regress/expected/multi_test_helpers.out b/src/test/regress/expected/multi_test_helpers.out index 53edd1188..74ec1248a 100644 --- a/src/test/regress/expected/multi_test_helpers.out +++ b/src/test/regress/expected/multi_test_helpers.out @@ -547,7 +547,7 @@ AS $func$ END; $func$ LANGUAGE plpgsql; -- Takes a table name and returns a json object for each shard group that --- contains a shard whose placements need isolation. +-- contains a shard whose placements need separate nodes. -- -- This does not only return the shards of input relation but also considers -- all colocated relations. @@ -562,7 +562,7 @@ $func$ LANGUAGE plpgsql; -- It only returned shard groups 10 and 15 because they are the only shard groups -- that contain at least one shard whose placements need an isolation. -- --- (Innermost) Boolean values represent needsisolatednode value for given +-- (Innermost) Boolean values represent needsseparatenode value for given -- shard. For example, -- -- {"15": [{"dist_1": false},{"dist_3": true}]} @@ -576,22 +576,22 @@ RETURNS SETOF jsonb AS $func$ RETURN QUERY SELECT COALESCE( - jsonb_agg(jsonb_build_object(shardgroupindex, needsisolatednodejson) ORDER BY shardgroupindex), + jsonb_agg(jsonb_build_object(shardgroupindex, needsseparatenodejson) ORDER BY shardgroupindex), '{}'::jsonb ) AS result FROM ( SELECT shardgroupindex, - jsonb_agg(jsonb_build_object(logicalrelid, needsisolatednode) ORDER BY logicalrelid::text) AS needsisolatednodejson + jsonb_agg(jsonb_build_object(logicalrelid, needsseparatenode) ORDER BY logicalrelid::text) AS needsseparatenodejson FROM ( SELECT shardgroupindex, logicalrelid, - needsisolatednode + needsseparatenode FROM public.get_enumerated_shard_groups(qualified_table_name) AS shardgroups JOIN pg_dist_shard ON shardid = ANY(shardids) ) q1 GROUP BY shardgroupindex ) q2 - WHERE needsisolatednodejson::text LIKE '%true%'; + WHERE needsseparatenodejson::text LIKE '%true%'; END; $func$ LANGUAGE plpgsql; diff --git a/src/test/regress/expected/upgrade_list_citus_objects.out b/src/test/regress/expected/upgrade_list_citus_objects.out index 05cbcc161..6050225b8 100644 --- a/src/test/regress/expected/upgrade_list_citus_objects.out +++ b/src/test/regress/expected/upgrade_list_citus_objects.out @@ -81,7 +81,7 @@ ORDER BY 1; function citus_internal_is_replication_origin_tracking_active() function citus_internal_local_blocked_processes() function citus_internal_mark_node_not_synced(integer,integer) - function citus_internal_shard_group_set_needsisolatednode(bigint,boolean) + function citus_internal_shard_group_set_needsseparatenode(bigint,boolean) function citus_internal_start_replication_origin_tracking() function citus_internal_stop_replication_origin_tracking() function citus_internal_unregister_tenant_schema_globally(oid,text) diff --git a/src/test/regress/sql/isolate_placement.sql b/src/test/regress/sql/isolate_placement.sql index c9376b77f..dad3b23c8 100644 --- a/src/test/regress/sql/isolate_placement.sql +++ b/src/test/regress/sql/isolate_placement.sql @@ -34,8 +34,8 @@ CREATE SCHEMA isolate_placement; SET search_path TO isolate_placement; -- test null input -SELECT citus_internal_shard_group_set_needsisolatednode(0, NULL); -SELECT citus_internal_shard_group_set_needsisolatednode(NULL, false); +SELECT citus_internal_shard_group_set_needsseparatenode(0, NULL); +SELECT citus_internal_shard_group_set_needsseparatenode(NULL, false); SET citus.shard_replication_factor TO 1; SET citus.next_shard_id TO 2000000; @@ -44,7 +44,7 @@ CREATE TABLE single_shard_1(a int); SELECT create_distributed_table('single_shard_1', null, colocate_with=>'none'); -- test with user that doesn't have permission to execute the function -SELECT citus_internal_shard_group_set_needsisolatednode(shardid, true) FROM pg_dist_shard WHERE logicalrelid = 'isolate_placement.single_shard_1'::regclass; +SELECT citus_internal_shard_group_set_needsseparatenode(shardid, true) FROM pg_dist_shard WHERE logicalrelid = 'isolate_placement.single_shard_1'::regclass; DROP TABLE single_shard_1; @@ -56,16 +56,16 @@ SELECT pg_sleep(0.1); SET ROLE test_user_isolate_placement; -- test invalid shard id -SELECT citus_internal_shard_group_set_needsisolatednode(0, true); +SELECT citus_internal_shard_group_set_needsseparatenode(0, true); --- test null needs_isolated_node +-- test null needs_separate_node SELECT citus_internal_add_shard_metadata( relation_id=>0, shard_id=>0, storage_type=>'0', shard_min_value=>'0', shard_max_value=>'0', - needs_isolated_node=>null); + needs_separate_node=>null); RESET ROLE; REVOKE ALL ON SCHEMA isolate_placement FROM test_user_isolate_placement; @@ -95,7 +95,7 @@ SET ROLE regularuser; -- throws an error as the user is not the owner of the table SELECT citus_shard_property_set(shardid) FROM pg_dist_shard WHERE logicalrelid = 'isolate_placement.single_shard_1'::regclass; SELECT citus_shard_property_set(shardid, anti_affinity=>true) FROM pg_dist_shard WHERE logicalrelid = 'isolate_placement.single_shard_1'::regclass; -SELECT citus_internal_shard_group_set_needsisolatednode(shardid, true) FROM pg_dist_shard WHERE logicalrelid = 'isolate_placement.single_shard_1'::regclass; +SELECT citus_internal_shard_group_set_needsseparatenode(shardid, true) FROM pg_dist_shard WHERE logicalrelid = 'isolate_placement.single_shard_1'::regclass; -- assign all tables to regularuser RESET ROLE; @@ -110,14 +110,14 @@ SELECT result FROM run_command_on_all_nodes($$ $$) ORDER BY result; -SELECT citus_internal_shard_group_set_needsisolatednode(shardid, false) FROM pg_dist_shard WHERE logicalrelid = 'isolate_placement.single_shard_1'::regclass; +SELECT citus_internal_shard_group_set_needsseparatenode(shardid, false) FROM pg_dist_shard WHERE logicalrelid = 'isolate_placement.single_shard_1'::regclass; SELECT result FROM run_command_on_all_nodes($$ SELECT * FROM public.get_colocated_shards_needisolatednode('isolate_placement.single_shard_1') $$) ORDER BY result; -SELECT citus_internal_shard_group_set_needsisolatednode(shardid, true) FROM pg_dist_shard WHERE logicalrelid = 'isolate_placement.single_shard_1'::regclass; +SELECT citus_internal_shard_group_set_needsseparatenode(shardid, true) FROM pg_dist_shard WHERE logicalrelid = 'isolate_placement.single_shard_1'::regclass; DROP TABLE single_shard_1; RESET ROLE; @@ -148,7 +148,7 @@ SELECT create_distributed_table('dist_3', 'a', colocate_with=>'dist_1'); SET citus.shard_replication_factor TO 1; --- none of the placements have been marked as needsisolatednode yet +-- none of the placements have been marked as needsseparatenode yet SELECT result FROM run_command_on_all_nodes($$ SELECT * FROM public.get_colocated_shards_needisolatednode('isolate_placement.dist_1') $$) @@ -239,7 +239,7 @@ CREATE TABLE dist_4_concurrently(a int); SELECT create_distributed_table_concurrently('dist_4_concurrently', 'a', colocate_with=>'dist_1'); -- Placements of a new distributed table created within the same colocated --- group inherit needsisolatednode from the colocated placements too. +-- group inherit needsseparatenode from the colocated placements too. SELECT result FROM run_command_on_all_nodes($$ SELECT * FROM public.get_colocated_shards_needisolatednode('isolate_placement.dist_1') $$) @@ -368,7 +368,7 @@ FROM pg_dist_shard WHERE shardid = :shardgroup_9_shardid; -- We shouldn't see shard group 9 because shard-split operation doesn't --- preserve needsisolatednode flag when splitting the shard. +-- preserve needsseparatenode flag when splitting the shard. SELECT result FROM run_command_on_all_nodes($$ SELECT * FROM public.get_colocated_shards_needisolatednode('isolate_placement.dist_1') $$) @@ -424,7 +424,7 @@ select get_shard_id_for_distribution_column('dist_3', 100) = :shardgroup_17_shar SELECT 1 FROM isolate_tenant_to_new_shard('dist_3', 100, shard_transfer_mode => 'block_writes'); -- We shouldn't see shard group 17 because isolate_tenant_to_new_shard doesn't --- preserve needsisolatednode flag when splitting the shard. +-- preserve needsseparatenode flag when splitting the shard. SELECT result FROM run_command_on_all_nodes($$ SELECT * FROM public.get_colocated_shards_needisolatednode('isolate_placement.dist_3') $$) diff --git a/src/test/regress/sql/multi_test_helpers.sql b/src/test/regress/sql/multi_test_helpers.sql index 29dfb7725..c7d375112 100644 --- a/src/test/regress/sql/multi_test_helpers.sql +++ b/src/test/regress/sql/multi_test_helpers.sql @@ -575,7 +575,7 @@ $func$ LANGUAGE plpgsql; -- Takes a table name and returns a json object for each shard group that --- contains a shard whose placements need isolation. +-- contains a shard whose placements need separate nodes. -- -- This does not only return the shards of input relation but also considers -- all colocated relations. @@ -590,7 +590,7 @@ $func$ LANGUAGE plpgsql; -- It only returned shard groups 10 and 15 because they are the only shard groups -- that contain at least one shard whose placements need an isolation. -- --- (Innermost) Boolean values represent needsisolatednode value for given +-- (Innermost) Boolean values represent needsseparatenode value for given -- shard. For example, -- -- {"15": [{"dist_1": false},{"dist_3": true}]} @@ -604,22 +604,22 @@ RETURNS SETOF jsonb AS $func$ RETURN QUERY SELECT COALESCE( - jsonb_agg(jsonb_build_object(shardgroupindex, needsisolatednodejson) ORDER BY shardgroupindex), + jsonb_agg(jsonb_build_object(shardgroupindex, needsseparatenodejson) ORDER BY shardgroupindex), '{}'::jsonb ) AS result FROM ( SELECT shardgroupindex, - jsonb_agg(jsonb_build_object(logicalrelid, needsisolatednode) ORDER BY logicalrelid::text) AS needsisolatednodejson + jsonb_agg(jsonb_build_object(logicalrelid, needsseparatenode) ORDER BY logicalrelid::text) AS needsseparatenodejson FROM ( SELECT shardgroupindex, logicalrelid, - needsisolatednode + needsseparatenode FROM public.get_enumerated_shard_groups(qualified_table_name) AS shardgroups JOIN pg_dist_shard ON shardid = ANY(shardids) ) q1 GROUP BY shardgroupindex ) q2 - WHERE needsisolatednodejson::text LIKE '%true%'; + WHERE needsseparatenodejson::text LIKE '%true%'; END; $func$ LANGUAGE plpgsql;