mirror of https://github.com/citusdata/citus.git
Update src/backend/distributed/metadata/node_metadata.c
Co-authored-by: Onur Tirtir <onurcantirtir@gmail.com>pull/7720/head
parent
2f87e83f4c
commit
09ab4bdcb3
|
@ -1678,11 +1678,20 @@ citus_is_primary_node(PG_FUNCTION_ARGS)
|
||||||
bool isPrimary = false;
|
bool isPrimary = false;
|
||||||
int32 groupId = GetLocalGroupId();
|
int32 groupId = GetLocalGroupId();
|
||||||
WorkerNode *workerNode = PrimaryNodeForGroup(groupId, NULL);
|
WorkerNode *workerNode = PrimaryNodeForGroup(groupId, NULL);
|
||||||
if (workerNode != NULL && workerNode->nodeId == GetLocalNodeId())
|
if (workerNode == NULL)
|
||||||
{
|
{
|
||||||
isPrimary = true;
|
ereport(WARNING, (errmsg("could not find the current node in pg_dist_node"),
|
||||||
|
errdetail("If this is the coordinator node, consider adding it "
|
||||||
|
"into the metadata by using citus_set_coordinator_host() "
|
||||||
|
"UDF. Otherwise, if you're going to use this node as a "
|
||||||
|
"worker node for a new cluster, make sure to add this "
|
||||||
|
"node into the metadata from the coordinator by using "
|
||||||
|
"citus_add_node() UDF."));
|
||||||
|
PG_RETURN_NULL();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isPrimary = workerNode->nodeId == GetLocalNodeId();
|
||||||
|
|
||||||
PG_RETURN_BOOL(isPrimary);
|
PG_RETURN_BOOL(isPrimary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue