Merge branch 'main' into main

pull/7694/head
Onur Tirtir 2025-03-05 17:52:25 +03:00 committed by GitHub
commit 712342ac85
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 4 deletions

View File

@ -431,6 +431,11 @@ PrepareAndSetTransactionClock(void)
MultiConnection *connection = dlist_container(MultiConnection, transactionNode,
iter.cur);
WorkerNode *workerNode = FindWorkerNode(connection->hostname, connection->port);
if (!workerNode)
{
ereport(WARNING, errmsg("Worker node is missing"));
continue;
}
/* Skip the node if we already in the list */
if (list_member_int(nodeList, workerNode->groupId))

View File

@ -40,6 +40,15 @@ worker_copy_table_to_node(PG_FUNCTION_ARGS)
Oid relationId = PG_GETARG_OID(0);
uint32_t targetNodeId = PG_GETARG_INT32(1);
if (IsCitusTable(relationId))
{
char *qualifiedRelationName = generate_qualified_relation_name(relationId);
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("table %s is a Citus table, only copies of "
"shards or regular postgres tables are supported",
qualifiedRelationName)));
}
Oid schemaOid = get_rel_namespace(relationId);
char *relationSchemaName = get_namespace_name(schemaOid);
char *relationName = get_rel_name(relationId);

View File

@ -37,11 +37,9 @@ CREATE TABLE t_62629600(a int);
SET search_path TO worker_copy_table_to_node;
-- Make sure that the UDF doesn't work on Citus tables
SELECT worker_copy_table_to_node('t', :worker_1_node);
ERROR: cannot execute a distributed query from a query on a shard
DETAIL: Executing a distributed query in a function call that may be pushed to a remote node can lead to incorrect results.
ERROR: table worker_copy_table_to_node.t is a Citus table, only copies of shards or regular postgres tables are supported
SELECT worker_copy_table_to_node('ref', :worker_1_node);
ERROR: cannot execute a distributed query from a query on a shard
DETAIL: Executing a distributed query in a function call that may be pushed to a remote node can lead to incorrect results.
ERROR: table worker_copy_table_to_node.ref is a Citus table, only copies of shards or regular postgres tables are supported
-- It should work on shards
SELECT worker_copy_table_to_node('t_62629600', :worker_1_node);
worker_copy_table_to_node