Rename a function that collides with PG15 (#6422)

PG15 introduced a function called ReplicationSlotName that causes
conflicts with our function with the same name. I solved this issue by
renaming our function to ReplicationSlotNameForNodeAndOwner

Relevant PG commit:
c3b5992b91

(cherry picked from commit ec3eebbaf6)
pull/6482/head
Hanefi Onaldi 2022-10-12 13:24:04 +03:00 committed by naisila
parent 64db74c051
commit 26ae4b8fb3
3 changed files with 16 additions and 10 deletions

View File

@ -281,7 +281,8 @@ PopulateShardSplitInfoInSM(ShardSplitInfoSMHeader *shardSplitInfoSMHeader)
{
uint32_t nodeId = entry->key.nodeId;
uint32_t tableOwnerId = entry->key.tableOwnerId;
char *derivedSlotName = ReplicationSlotName(SHARD_SPLIT, nodeId, tableOwnerId);
char *derivedSlotName = ReplicationSlotNameForNodeAndOwner(SHARD_SPLIT, nodeId,
tableOwnerId);
List *shardSplitInfoList = entry->shardSplitInfoList;
ShardSplitInfo *splitShardInfo = NULL;
@ -389,8 +390,9 @@ ReturnReplicationSlotInfo(Tuplestorestate *tupleStore, TupleDesc
char *tableOwnerName = GetUserNameFromId(entry->key.tableOwnerId, false);
values[1] = CStringGetTextDatum(tableOwnerName);
char *slotName = ReplicationSlotName(SHARD_SPLIT, entry->key.nodeId,
entry->key.tableOwnerId);
char *slotName = ReplicationSlotNameForNodeAndOwner(SHARD_SPLIT,
entry->key.nodeId,
entry->key.tableOwnerId);
values[2] = CStringGetTextDatum(slotName);
tuplestore_putvalues(tupleStore, tupleDescriptor, values, nulls);

View File

@ -501,9 +501,9 @@ CreateShardMoveLogicalRepTargetList(HTAB *publicationInfoHash, List *shardList)
target->newShards = NIL;
target->subscriptionOwnerName = SubscriptionRoleName(SHARD_MOVE, ownerId);
target->replicationSlot = palloc0(sizeof(ReplicationSlotInfo));
target->replicationSlot->name = ReplicationSlotName(SHARD_MOVE,
nodeId,
ownerId);
target->replicationSlot->name = ReplicationSlotNameForNodeAndOwner(SHARD_MOVE,
nodeId,
ownerId);
target->replicationSlot->targetNodeId = nodeId;
target->replicationSlot->tableOwnerId = ownerId;
logicalRepTargetList = lappend(logicalRepTargetList, target);
@ -1381,11 +1381,14 @@ PublicationName(LogicalRepType type, uint32_t nodeId, Oid ownerId)
/*
* ReplicationSlotName returns the name of the replication slot for the given
* node and table owner.
* ReplicationSlotNameForNodeAndOwner returns the name of the replication slot for the
* given node and table owner.
*
* Note that PG15 introduced a new ReplicationSlotName function that caused name conflicts
* and we renamed this function.
*/
char *
ReplicationSlotName(LogicalRepType type, uint32_t nodeId, Oid ownerId)
ReplicationSlotNameForNodeAndOwner(LogicalRepType type, uint32_t nodeId, Oid ownerId)
{
StringInfo slotName = makeStringInfo();
appendStringInfo(slotName, "%s%u_%u", replicationSlotPrefix[type], nodeId,

View File

@ -157,7 +157,8 @@ extern void DropPublications(MultiConnection *sourceConnection,
extern void DropAllLogicalReplicationLeftovers(LogicalRepType type);
extern char * PublicationName(LogicalRepType type, uint32_t nodeId, Oid ownerId);
extern char * ReplicationSlotName(LogicalRepType type, uint32_t nodeId, Oid ownerId);
extern char * ReplicationSlotNameForNodeAndOwner(LogicalRepType type, uint32_t nodeId, Oid
ownerId);
extern char * SubscriptionName(LogicalRepType type, Oid ownerId);
extern char * SubscriptionRoleName(LogicalRepType type, Oid ownerId);