mirror of https://github.com/citusdata/citus.git
Merge 6de73eb656
into 4cd8bb1b67
commit
0d8433580c
|
@ -2962,7 +2962,7 @@ SyncNodeMetadataToNodesOptional(void)
|
||||||
/* we fetch the same node again to check if it's synced or not */
|
/* we fetch the same node again to check if it's synced or not */
|
||||||
WorkerNode *nodeUpdated = FindWorkerNode(workerNode->workerName,
|
WorkerNode *nodeUpdated = FindWorkerNode(workerNode->workerName,
|
||||||
workerNode->workerPort);
|
workerNode->workerPort);
|
||||||
if (!nodeUpdated->metadataSynced)
|
if (nodeUpdated == NULL || !nodeUpdated->metadataSynced)
|
||||||
{
|
{
|
||||||
/* set the result to FAILED to trigger the sync again */
|
/* set the result to FAILED to trigger the sync again */
|
||||||
result = NODE_METADATA_SYNC_FAILED_SYNC;
|
result = NODE_METADATA_SYNC_FAILED_SYNC;
|
||||||
|
|
|
@ -110,7 +110,7 @@ ActiveReadableNodeCount(void)
|
||||||
* NodeIsCoordinator returns true if the given node represents the coordinator.
|
* NodeIsCoordinator returns true if the given node represents the coordinator.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
NodeIsCoordinator(WorkerNode *node)
|
NodeIsCoordinator(const WorkerNode *node)
|
||||||
{
|
{
|
||||||
return node->groupId == COORDINATOR_GROUP_ID;
|
return node->groupId == COORDINATOR_GROUP_ID;
|
||||||
}
|
}
|
||||||
|
@ -354,6 +354,9 @@ CompareWorkerNodes(const void *leftElement, const void *rightElement)
|
||||||
* WorkerNodeCompare compares two worker nodes by their host name and port
|
* WorkerNodeCompare compares two worker nodes by their host name and port
|
||||||
* number. Two nodes that only differ by their rack locations are considered to
|
* number. Two nodes that only differ by their rack locations are considered to
|
||||||
* be equal to each other.
|
* be equal to each other.
|
||||||
|
*
|
||||||
|
* This function also makes sure that coordinator nodes are always considered
|
||||||
|
* lexicographically smaller than other worker nodes.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
WorkerNodeCompare(const void *lhsKey, const void *rhsKey, Size keySize)
|
WorkerNodeCompare(const void *lhsKey, const void *rhsKey, Size keySize)
|
||||||
|
@ -361,6 +364,15 @@ WorkerNodeCompare(const void *lhsKey, const void *rhsKey, Size keySize)
|
||||||
const WorkerNode *workerLhs = (const WorkerNode *) lhsKey;
|
const WorkerNode *workerLhs = (const WorkerNode *) lhsKey;
|
||||||
const WorkerNode *workerRhs = (const WorkerNode *) rhsKey;
|
const WorkerNode *workerRhs = (const WorkerNode *) rhsKey;
|
||||||
|
|
||||||
|
if (NodeIsCoordinator(workerLhs))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (NodeIsCoordinator(workerRhs))
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
return NodeNamePortCompare(workerLhs->workerName, workerRhs->workerName,
|
return NodeNamePortCompare(workerLhs->workerName, workerRhs->workerName,
|
||||||
workerLhs->workerPort, workerRhs->workerPort);
|
workerLhs->workerPort, workerRhs->workerPort);
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ extern bool NodeIsPrimaryAndRemote(WorkerNode *worker);
|
||||||
extern bool NodeIsPrimary(WorkerNode *worker);
|
extern bool NodeIsPrimary(WorkerNode *worker);
|
||||||
extern bool NodeIsSecondary(WorkerNode *worker);
|
extern bool NodeIsSecondary(WorkerNode *worker);
|
||||||
extern bool NodeIsReadable(WorkerNode *worker);
|
extern bool NodeIsReadable(WorkerNode *worker);
|
||||||
extern bool NodeIsCoordinator(WorkerNode *node);
|
extern bool NodeIsCoordinator(const WorkerNode *node);
|
||||||
extern WorkerNode * SetWorkerColumn(WorkerNode *workerNode, int columnIndex, Datum value);
|
extern WorkerNode * SetWorkerColumn(WorkerNode *workerNode, int columnIndex, Datum value);
|
||||||
extern WorkerNode * SetWorkerColumnOptional(WorkerNode *workerNode, int columnIndex, Datum
|
extern WorkerNode * SetWorkerColumnOptional(WorkerNode *workerNode, int columnIndex, Datum
|
||||||
value);
|
value);
|
||||||
|
|
Loading…
Reference in New Issue