Pass entire ShardPlacement into WorkerShardStats

A small refactor so we'll be able to call the new connection API (which
requires having a ShardPlacement) from within WorkerShardStats.
pull/1139/head
Brian Cloutier 2017-01-12 18:31:33 +03:00 committed by Brian Cloutier
parent 3ea73b7879
commit 539a205462
1 changed files with 6 additions and 5 deletions

View File

@ -44,7 +44,7 @@
/* Local functions forward declarations */ /* Local functions forward declarations */
static bool WorkerShardStats(char *nodeName, uint32 nodePort, Oid relationId, static bool WorkerShardStats(ShardPlacement *placement, Oid relationId,
char *shardName, uint64 *shardSize, char *shardName, uint64 *shardSize,
text **shardMinValue, text **shardMaxValue); text **shardMinValue, text **shardMaxValue);
@ -570,10 +570,8 @@ UpdateShardStatistics(int64 shardId)
foreach(shardPlacementCell, shardPlacementList) foreach(shardPlacementCell, shardPlacementList)
{ {
ShardPlacement *placement = (ShardPlacement *) lfirst(shardPlacementCell); ShardPlacement *placement = (ShardPlacement *) lfirst(shardPlacementCell);
char *workerName = placement->nodeName;
uint32 workerPort = placement->nodePort;
statsOK = WorkerShardStats(workerName, workerPort, relationId, shardQualifiedName, statsOK = WorkerShardStats(placement, relationId, shardQualifiedName,
&shardSize, &minValue, &maxValue); &shardSize, &minValue, &maxValue);
if (statsOK) if (statsOK)
{ {
@ -636,9 +634,12 @@ UpdateShardStatistics(int64 shardId)
* we assume have changed after new table data have been appended to the shard. * we assume have changed after new table data have been appended to the shard.
*/ */
static bool static bool
WorkerShardStats(char *nodeName, uint32 nodePort, Oid relationId, char *shardName, WorkerShardStats(ShardPlacement *placement, Oid relationId, char *shardName,
uint64 *shardSize, text **shardMinValue, text **shardMaxValue) uint64 *shardSize, text **shardMinValue, text **shardMaxValue)
{ {
char *nodeName = placement->nodeName;
uint32 nodePort = placement->nodePort;
char *quotedShardName = NULL; char *quotedShardName = NULL;
bool cstoreTable = false; bool cstoreTable = false;
StringInfo tableSizeQuery = makeStringInfo(); StringInfo tableSizeQuery = makeStringInfo();