mirror of https://github.com/citusdata/citus.git
WorkerNodeList only returns primaries
parent
f79d7a1f4d
commit
b081fb0efa
|
@ -18,6 +18,7 @@
|
||||||
#include "distributed/worker_manager.h"
|
#include "distributed/worker_manager.h"
|
||||||
#include "distributed/metadata_cache.h"
|
#include "distributed/metadata_cache.h"
|
||||||
#include "distributed/multi_client_executor.h"
|
#include "distributed/multi_client_executor.h"
|
||||||
|
#include "distributed/pg_dist_node.h"
|
||||||
#include "libpq/hba.h"
|
#include "libpq/hba.h"
|
||||||
#include "libpq/ip.h"
|
#include "libpq/ip.h"
|
||||||
#include "libpq/libpq-be.h"
|
#include "libpq/libpq-be.h"
|
||||||
|
@ -312,6 +313,8 @@ WorkerGetLiveNodeCount(void)
|
||||||
/*
|
/*
|
||||||
* WorkerNodeList iterates over the hash table that includes the worker nodes, and adds
|
* WorkerNodeList iterates over the hash table that includes the worker nodes, and adds
|
||||||
* them to a list which is returned.
|
* them to a list which is returned.
|
||||||
|
*
|
||||||
|
* It only returns nodes which are primaries.
|
||||||
*/
|
*/
|
||||||
List *
|
List *
|
||||||
WorkerNodeList(void)
|
WorkerNodeList(void)
|
||||||
|
@ -326,6 +329,12 @@ WorkerNodeList(void)
|
||||||
while ((workerNode = hash_seq_search(&status)) != NULL)
|
while ((workerNode = hash_seq_search(&status)) != NULL)
|
||||||
{
|
{
|
||||||
WorkerNode *workerNodeCopy = palloc0(sizeof(WorkerNode));
|
WorkerNode *workerNodeCopy = palloc0(sizeof(WorkerNode));
|
||||||
|
|
||||||
|
if(workerNode->nodeRole != NODE_ROLE_PRIMARY)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
memcpy(workerNodeCopy, workerNode, sizeof(WorkerNode));
|
memcpy(workerNodeCopy, workerNode, sizeof(WorkerNode));
|
||||||
workerNodeList = lappend(workerNodeList, workerNodeCopy);
|
workerNodeList = lappend(workerNodeList, workerNodeCopy);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue