mirror of https://github.com/citusdata/citus.git
Convert DistributedTableSizeOnWorker function to new connection API
parent
802ff0db2f
commit
43d2cdbd35
|
@ -190,8 +190,12 @@ DistributedTableSizeOnWorker(WorkerNode *workerNode, Oid relationId, char *sizeQ
|
||||||
char *workerNodeName = workerNode->workerName;
|
char *workerNodeName = workerNode->workerName;
|
||||||
uint32 workerNodePort = workerNode->workerPort;
|
uint32 workerNodePort = workerNode->workerPort;
|
||||||
char *tableSizeString;
|
char *tableSizeString;
|
||||||
List *sizeList = NIL;
|
|
||||||
uint64 tableSize = 0;
|
uint64 tableSize = 0;
|
||||||
|
MultiConnection *connection = NULL;
|
||||||
|
uint32 connectionFlag = FORCE_NEW_CONNECTION;
|
||||||
|
PGresult *result = NULL;
|
||||||
|
int queryResult = 0;
|
||||||
|
List *sizeList = NIL;
|
||||||
|
|
||||||
List *shardIntervalsOnNode = ShardIntervalsOnWorkerNode(workerNode, relationId);
|
List *shardIntervalsOnNode = ShardIntervalsOnWorkerNode(workerNode, relationId);
|
||||||
|
|
||||||
|
@ -199,14 +203,16 @@ DistributedTableSizeOnWorker(WorkerNode *workerNode, Oid relationId, char *sizeQ
|
||||||
shardIntervalsOnNode,
|
shardIntervalsOnNode,
|
||||||
sizeQuery);
|
sizeQuery);
|
||||||
|
|
||||||
sizeList = ExecuteRemoteQuery(workerNodeName, workerNodePort, NULL, tableSizeQuery);
|
connection = GetNodeConnection(connectionFlag, workerNodeName, workerNodePort);
|
||||||
|
queryResult = ExecuteOptionalRemoteCommand(connection, tableSizeQuery->data, &result);
|
||||||
|
|
||||||
if (sizeList == NIL)
|
if (queryResult != 0)
|
||||||
{
|
{
|
||||||
ereport(ERROR, (errcode(ERRCODE_CONNECTION_FAILURE),
|
ereport(ERROR, (errcode(ERRCODE_CONNECTION_FAILURE),
|
||||||
errmsg("cannot get the size because of a connection error")));
|
errmsg("cannot get the size because of a connection error")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sizeList = ReadFirstColumnAsText(result);
|
||||||
tableSizeStringInfo = (StringInfo) linitial(sizeList);
|
tableSizeStringInfo = (StringInfo) linitial(sizeList);
|
||||||
tableSizeString = tableSizeStringInfo->data;
|
tableSizeString = tableSizeStringInfo->data;
|
||||||
tableSize = atol(tableSizeString);
|
tableSize = atol(tableSizeString);
|
||||||
|
|
Loading…
Reference in New Issue