mirror of https://github.com/citusdata/citus.git
Copy WorkerNode before returning in FindWorkerNode
parent
99f18c55d9
commit
97334ff1ec
|
@ -764,7 +764,7 @@ get_shard_id_for_distribution_column(PG_FUNCTION_ARGS)
|
||||||
WorkerNode *
|
WorkerNode *
|
||||||
FindWorkerNode(char *nodeName, int32 nodePort)
|
FindWorkerNode(char *nodeName, int32 nodePort)
|
||||||
{
|
{
|
||||||
WorkerNode *workerNode = NULL;
|
WorkerNode *cachedWorkerNode = NULL;
|
||||||
HTAB *workerNodeHash = GetWorkerNodeHash();
|
HTAB *workerNodeHash = GetWorkerNodeHash();
|
||||||
bool handleFound = false;
|
bool handleFound = false;
|
||||||
void *hashKey = NULL;
|
void *hashKey = NULL;
|
||||||
|
@ -774,12 +774,18 @@ FindWorkerNode(char *nodeName, int32 nodePort)
|
||||||
searchedNode->workerPort = nodePort;
|
searchedNode->workerPort = nodePort;
|
||||||
|
|
||||||
hashKey = (void *) searchedNode;
|
hashKey = (void *) searchedNode;
|
||||||
workerNode = (WorkerNode *) hash_search(workerNodeHash, hashKey,
|
cachedWorkerNode = (WorkerNode *) hash_search(workerNodeHash, hashKey, HASH_FIND,
|
||||||
HASH_FIND, &handleFound);
|
&handleFound);
|
||||||
|
if (handleFound)
|
||||||
|
{
|
||||||
|
WorkerNode *workerNode = (WorkerNode *) palloc(sizeof(WorkerNode));
|
||||||
|
memcpy(workerNode, cachedWorkerNode, sizeof(WorkerNode));
|
||||||
return workerNode;
|
return workerNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FindWorkerNodeAnyCluster returns the workerNode no matter which cluster it is a part
|
* FindWorkerNodeAnyCluster returns the workerNode no matter which cluster it is a part
|
||||||
|
|
Loading…
Reference in New Issue