*/
newLocInfo = CopyRelationLocInfo(oldLocInfo);
/* The node list of this locator information will be rebuilt after command scan */
- list_free(newLocInfo->nodeList);
- newLocInfo->nodeList = NULL;
+ list_free(newLocInfo->rl_nodeList);
+ newLocInfo->rl_nodeList = NULL;
/* Get the list to be modified */
new_num = get_pgxc_classnodes(RelationGetRelid(rel), &new_oid_array);
/* Build relation node list for new locator info */
for (i = 0; i < new_num; i++)
- newLocInfo->nodeList = lappend_int(newLocInfo->nodeList,
+ newLocInfo->rl_nodeList = lappend_int(newLocInfo->rl_nodeList,
PGXCNodeGetNodeId(new_oid_array[i],
&node_type));
/* Build the command tree for table redistribution */
{
int nindexes;
Relation *Irel;
- int nodes = list_length(RelationGetLocInfo(onerel)->nodeList);
+ int nodes = list_length(RelationGetLocInfo(onerel)->rl_nodeList);
vac_open_indexes(onerel, ShareUpdateExclusiveLock, &nindexes, &Irel);
hasindex = (nindexes > 0);
ListCell *lc;
distribution->distributionType = rel_loc_info->locatorType;
- foreach(lc, rel_loc_info->nodeList)
+ foreach(lc, rel_loc_info->rl_nodeList)
distribution->nodes = bms_add_member(distribution->nodes,
lfirst_int(lc));
distribution->restrictNodes = NULL;
int i;
bool healthmap[MaxDataNodes];
- PgxcNodeDnListHealth(rel_loc_info->nodeList, healthmap);
+ PgxcNodeDnListHealth(rel_loc_info->rl_nodeList, healthmap);
i = 0;
- foreach(lc, rel_loc_info->nodeList)
+ foreach(lc, rel_loc_info->rl_nodeList)
{
if (healthmap[i++] == true)
distribution->nodes = bms_add_member(distribution->nodes,
}
else
{
- foreach(lc, rel_loc_info->nodeList)
+ foreach(lc, rel_loc_info->rl_nodeList)
distribution->nodes = bms_add_member(distribution->nodes,
lfirst_int(lc));
}
ListCell *lc;
bool healthmap[MaxDataNodes];
- PgxcNodeDnListHealth(rel_loc_info->nodeList, healthmap);
+ PgxcNodeDnListHealth(rel_loc_info->rl_nodeList, healthmap);
i = 0;
- foreach(lc, rel_loc_info->nodeList)
+ foreach(lc, rel_loc_info->rl_nodeList)
{
if (!healthmap[i++])
newlist = lappend_int(newlist, lfirst_int(lc));
}
if (newlist != NIL)
- rel_loc_info->nodeList = list_difference_int(rel_loc_info->nodeList,
+ rel_loc_info->rl_nodeList = list_difference_int(rel_loc_info->rl_nodeList,
newlist);
/*
* If all nodes are down, cannot do much, just return NULL here
*/
- if (rel_loc_info->nodeList == NIL)
+ if (rel_loc_info->rl_nodeList == NIL)
{
/*
* Try an on-demand pool maintenance just to see if some nodes
*/
if (retry)
{
- rel_loc_info->nodeList = newlist;
+ rel_loc_info->rl_nodeList = newlist;
newlist = NIL;
PoolPingNodes();
retry = false;
* Check if relation is distributed on a single node, in this case
* the constraint can be shipped in all the cases.
*/
- if (list_length(relLocInfo->nodeList) == 1)
+ if (list_length(relLocInfo->rl_nodeList) == 1)
return result;
/*
* Parent and child need to have their data located exactly
* on the same list of nodes.
*/
- if (list_difference_int(childLocInfo->nodeList, parentLocInfo->nodeList) ||
- list_difference_int(parentLocInfo->nodeList, childLocInfo->nodeList))
+ if (list_difference_int(childLocInfo->rl_nodeList, parentLocInfo->rl_nodeList) ||
+ list_difference_int(parentLocInfo->rl_nodeList, childLocInfo->rl_nodeList))
{
result = false;
break;
* Use defined node, if nothing defined get from the parent
*/
if (stmt->subcluster == NULL)
- stmt->subcluster = makeSubCluster(rel->rd_locator_info->nodeList);
+ stmt->subcluster = makeSubCluster(rel->rd_locator_info->rl_nodeList);
}
heap_close(rel, NoLock);
}
* Distribution nodes are defined, they must be a subset of
* the referenced relation's nodes
*/
- common = list_intersection_int(nodelist, rel_loc_info->nodeList);
+ common = list_intersection_int(nodelist, rel_loc_info->rl_nodeList);
if (list_length(common) < list_length(nodelist))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
/* suggest distribution */
if (nodelist)
{
- common = list_intersection_int(nodelist, rel_loc_info->nodeList);
+ common = list_intersection_int(nodelist, rel_loc_info->rl_nodeList);
if (list_length(common) == 0)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
nodelist = common;
}
else
- nodelist = rel_loc_info? list_copy(rel_loc_info->nodeList):NIL;
+ nodelist = rel_loc_info? list_copy(rel_loc_info->rl_nodeList):NIL;
}
}
else if (rel_loc_info->locatorType == LOCATOR_TYPE_RROBIN)
*/
if (cxt->subcluster)
{
- common = list_intersection_int(nodelist, rel_loc_info->nodeList);
- if (list_length(common) != list_length(rel_loc_info->nodeList) ||
+ common = list_intersection_int(nodelist, rel_loc_info->rl_nodeList);
+ if (list_length(common) != list_length(rel_loc_info->rl_nodeList) ||
list_length(common) != list_length(nodelist))
{
if (list_length(common) == 0)
{
if (nodelist)
{
- common = list_intersection_int(nodelist, rel_loc_info->nodeList);
- if (list_length(common) != list_length(rel_loc_info->nodeList))
+ common = list_intersection_int(nodelist, rel_loc_info->rl_nodeList);
+ if (list_length(common) != list_length(rel_loc_info->rl_nodeList))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("referenced HASH/MODULO table must be defined on same nodes")));
nodelist = common;
}
else
- nodelist = list_copy(rel_loc_info->nodeList);
+ nodelist = list_copy(rel_loc_info->rl_nodeList);
/* Now define the subcluster */
cxt->subcluster = makeSubCluster(nodelist);
}
rel->rd_locator_info->roundRobinNode = rel->rd_locator_info->roundRobinNode->next;
else
/* reset to first one */
- rel->rd_locator_info->roundRobinNode = rel->rd_locator_info->nodeList->head;
+ rel->rd_locator_info->roundRobinNode = rel->rd_locator_info->rl_nodeList->head;
relation_close(rel, AccessShareLock);
if (!OidIsValid(primary_data_node) ||
rel_loc_info == NULL ||
- list_length(rel_loc_info->nodeList = 0))
+ list_length(rel_loc_info->rl_nodeList = 0))
return false;
- foreach(item, rel_loc_info->nodeList)
+ foreach(item, rel_loc_info->rl_nodeList)
{
char ntype = PGXC_NODE_DATANODE;
if (PGXCNodeGetNodeId(primary_data_node, &ntype) == lfirst_int(item))
List *nodeList1, *nodeList2;
Assert(rel_loc_info1 && rel_loc_info2);
- nodeList1 = rel_loc_info1->nodeList;
- nodeList2 = rel_loc_info2->nodeList;
+ nodeList1 = rel_loc_info1->rl_nodeList;
+ nodeList2 = rel_loc_info2->rl_nodeList;
/* Same relation? */
if (rel_loc_info1->relid != rel_loc_info2->relid)
relationLocInfo->partAttrName = get_attname(relationLocInfo->relid, pgxc_class->pcattnum);
- relationLocInfo->nodeList = NIL;
+ relationLocInfo->rl_nodeList = NIL;
for (j = 0; j < pgxc_class->nodeoids.dim1; j++)
{
char ntype = PGXC_NODE_DATANODE;
int nid = PGXCNodeGetNodeId(pgxc_class->nodeoids.values[j], &ntype);
- relationLocInfo->nodeList = lappend_int(relationLocInfo->nodeList, nid);
+ relationLocInfo->rl_nodeList = lappend_int(relationLocInfo->rl_nodeList, nid);
}
/*
* pick a random one to start with,
* since each process will do this independently
*/
- offset = compute_modulo(abs(rand()), list_length(relationLocInfo->nodeList));
+ offset = compute_modulo(abs(rand()), list_length(relationLocInfo->rl_nodeList));
srand(time(NULL));
- relationLocInfo->roundRobinNode = relationLocInfo->nodeList->head; /* initialize */
+ relationLocInfo->roundRobinNode = relationLocInfo->rl_nodeList->head; /* initialize */
for (j = 0; j < offset && relationLocInfo->roundRobinNode->next != NULL; j++)
relationLocInfo->roundRobinNode = relationLocInfo->roundRobinNode->next;
}
if (src_info->partAttrName)
dest_info->partAttrName = pstrdup(src_info->partAttrName);
- if (src_info->nodeList)
- dest_info->nodeList = list_copy(src_info->nodeList);
+ if (src_info->rl_nodeList)
+ dest_info->rl_nodeList = list_copy(src_info->rl_nodeList);
/* Note, for round robin, we use the relcache entry */
return dest_info;
typeOfValueForDistCol,
LOCATOR_LIST_LIST,
0,
- (void *)rel_loc_info->nodeList,
+ (void *)rel_loc_info->rl_nodeList,
(void **)&nodenums,
false);
count = GET_NODES(locator, valueForDistCol, isValueNull, NULL);
return;
/* Get the list of nodes that are added to the relation */
- removedNodes = list_difference_int(oldLocInfo->nodeList, newLocInfo->nodeList);
+ removedNodes = list_difference_int(oldLocInfo->rl_nodeList, newLocInfo->rl_nodeList);
/* Get the list of nodes that are removed from relation */
- newNodes = list_difference_int(newLocInfo->nodeList, oldLocInfo->nodeList);
+ newNodes = list_difference_int(newLocInfo->rl_nodeList, oldLocInfo->rl_nodeList);
/*
* If some nodes are added, turn back to default, we need to fetch data
* If the table is redistributed to a single node, a TRUNCATE on removed nodes
* is sufficient so leave here.
*/
- if (list_length(newLocInfo->nodeList) == 1)
+ if (list_length(newLocInfo->rl_nodeList) == 1)
{
/* Add REINDEX command if necessary */
pgxc_redist_add_reindex(distribState);
if (newLocInfo->locatorType == LOCATOR_TYPE_HASH)
{
ExecNodes *execNodes = makeNode(ExecNodes);
- execNodes->nodeList = newLocInfo->nodeList;
+ execNodes->nodeList = newLocInfo->rl_nodeList;
distribState->commands = lappend(distribState->commands,
makeRedistribCommand(DISTRIB_DELETE_HASH, CATALOG_UPDATE_AFTER, execNodes));
}
else if (newLocInfo->locatorType == LOCATOR_TYPE_MODULO)
{
ExecNodes *execNodes = makeNode(ExecNodes);
- execNodes->nodeList = newLocInfo->nodeList;
+ execNodes->nodeList = newLocInfo->rl_nodeList;
distribState->commands = lappend(distribState->commands,
makeRedistribCommand(DISTRIB_DELETE_MODULO, CATALOG_UPDATE_AFTER, execNodes));
}
return;
/* Get the list of nodes that are added to the relation */
- removedNodes = list_difference_int(oldLocInfo->nodeList, newLocInfo->nodeList);
+ removedNodes = list_difference_int(oldLocInfo->rl_nodeList, newLocInfo->rl_nodeList);
/* Get the list of nodes that are removed from relation */
- newNodes = list_difference_int(newLocInfo->nodeList, oldLocInfo->nodeList);
+ newNodes = list_difference_int(newLocInfo->rl_nodeList, oldLocInfo->rl_nodeList);
/*
* If nodes have to be added, we need to fetch data for redistribution first.
if (exec_nodes)
{
if (exec_nodes->nodeList)
- copyState->rel_loc->nodeList = exec_nodes->nodeList;
+ copyState->rel_loc->rl_nodeList = exec_nodes->nodeList;
}
tupdesc = RelationGetDescr(rel);
* Find the correct node position in node list of locator information.
* So scan the node list and fetch the position of node.
*/
- foreach(item2, locinfo->nodeList)
+ foreach(item2, locinfo->rl_nodeList)
{
int loc = lfirst_int(item2);
if (loc == nodenum)
if (hashfuncname)
appendStringInfo(buf2, "%s WHERE abs(%s(%s)) %% %d != %d",
buf->data, hashfuncname, colname,
- list_length(locinfo->nodeList), nodepos);
+ list_length(locinfo->rl_nodeList), nodepos);
else
appendStringInfo(buf2, "%s WHERE abs(%s) %% %d != %d", buf->data, colname,
- list_length(locinfo->nodeList), nodepos);
+ list_length(locinfo->rl_nodeList), nodepos);
/* Then launch this single query */
distrib_execute_query(buf2->data, IsTempTable(relOid), local_exec_nodes);
DataNodeCopyBegin(RemoteCopyData *rcstate)
{
int i;
- List *nodelist = rcstate->rel_loc->nodeList;
+ List *nodelist = rcstate->rel_loc->rl_nodeList;
PGXCNodeHandle **connections;
bool need_tran_block;
GlobalTransactionId gxid;
char locatorType;
PartAttrNumber partAttrNum; /* if partitioned */
char *partAttrName; /* if partitioned */
- List *nodeList; /* Node Indices */
+ List *rl_nodeList; /* Node Indices */
ListCell *roundRobinNode; /* index of the next one to use */
} RelationLocInfo;