mirror of https://github.com/citusdata/citus.git
Merge branch 'master' into fix_spinlock_use
commit
3b95a03c3e
|
@ -229,28 +229,37 @@ ExecuteCommandsInParallelAndStoreResults(StringInfo *nodeNameArray, int *nodePor
|
||||||
palloc0(commmandCount * sizeof(MultiConnection *));
|
palloc0(commmandCount * sizeof(MultiConnection *));
|
||||||
int finishedCount = 0;
|
int finishedCount = 0;
|
||||||
|
|
||||||
/* establish connections */
|
/* start connections asynchronously */
|
||||||
for (commandIndex = 0; commandIndex < commmandCount; commandIndex++)
|
for (commandIndex = 0; commandIndex < commmandCount; commandIndex++)
|
||||||
{
|
{
|
||||||
char *nodeName = nodeNameArray[commandIndex]->data;
|
char *nodeName = nodeNameArray[commandIndex]->data;
|
||||||
int nodePort = nodePortArray[commandIndex];
|
int nodePort = nodePortArray[commandIndex];
|
||||||
int connectionFlags = FORCE_NEW_CONNECTION;
|
int connectionFlags = FORCE_NEW_CONNECTION;
|
||||||
MultiConnection *connection =
|
connectionArray[commandIndex] =
|
||||||
GetNodeConnection(connectionFlags, nodeName, nodePort);
|
StartNodeConnection(connectionFlags, nodeName, nodePort);
|
||||||
StringInfo queryResultString = resultStringArray[commandIndex];
|
}
|
||||||
|
|
||||||
statusArray[commandIndex] = true;
|
/* establish connections */
|
||||||
|
for (commandIndex = 0; commandIndex < commmandCount; commandIndex++)
|
||||||
|
{
|
||||||
|
MultiConnection *connection = connectionArray[commandIndex];
|
||||||
|
StringInfo queryResultString = resultStringArray[commandIndex];
|
||||||
|
char *nodeName = nodeNameArray[commandIndex]->data;
|
||||||
|
int nodePort = nodePortArray[commandIndex];
|
||||||
|
|
||||||
|
FinishConnectionEstablishment(connection);
|
||||||
|
|
||||||
if (PQstatus(connection->pgConn) != CONNECTION_OK)
|
if (PQstatus(connection->pgConn) != CONNECTION_OK)
|
||||||
{
|
{
|
||||||
appendStringInfo(queryResultString, "failed to connect to %s:%d", nodeName,
|
appendStringInfo(queryResultString, "failed to connect to %s:%d", nodeName,
|
||||||
(int) nodePort);
|
(int) nodePort);
|
||||||
statusArray[commandIndex] = false;
|
statusArray[commandIndex] = false;
|
||||||
|
connectionArray[commandIndex] = NULL;
|
||||||
finishedCount++;
|
finishedCount++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
connectionArray[commandIndex] = connection;
|
statusArray[commandIndex] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue