mirror of https://github.com/citusdata/citus.git
Merge pull request #1577 from citusdata/follower_get_active_worker_nodes
Return readable nodes in master_get_active_worker_nodespull/1585/head
commit
a5d54382ef
|
@ -399,7 +399,7 @@ master_get_active_worker_nodes(PG_FUNCTION_ARGS)
|
|||
/* switch to memory context appropriate for multiple function calls */
|
||||
oldContext = MemoryContextSwitchTo(functionContext->multi_call_memory_ctx);
|
||||
|
||||
workerNodeList = ActivePrimaryNodeList();
|
||||
workerNodeList = ActiveReadableNodeList();
|
||||
workerNodeCount = (uint32) list_length(workerNodeList);
|
||||
|
||||
functionContext->user_fctx = workerNodeList;
|
||||
|
|
|
@ -64,6 +64,18 @@ SELECT * FROM the_table;
|
|||
1 | 2
|
||||
(2 rows)
|
||||
|
||||
SELECT
|
||||
node_name, node_port
|
||||
FROM
|
||||
master_get_active_worker_nodes()
|
||||
ORDER BY
|
||||
node_name, node_port;
|
||||
node_name | node_port
|
||||
-----------+-----------
|
||||
localhost | 9071
|
||||
localhost | 9072
|
||||
(2 rows)
|
||||
|
||||
-- okay, now let's play with nodecluster. If we change the cluster of our follower node
|
||||
-- queries should stat failing again, since there are no worker nodes in the new cluster
|
||||
\c "port=9070 dbname=regression options='-c\ citus.use_secondary_nodes=always\ -c\ citus.cluster_name=second-cluster'"
|
||||
|
|
|
@ -42,6 +42,13 @@ SELECT 1 FROM master_add_node('localhost', :follower_worker_2_port,
|
|||
-- now that we've added secondaries this should work
|
||||
SELECT * FROM the_table;
|
||||
|
||||
SELECT
|
||||
node_name, node_port
|
||||
FROM
|
||||
master_get_active_worker_nodes()
|
||||
ORDER BY
|
||||
node_name, node_port;
|
||||
|
||||
-- okay, now let's play with nodecluster. If we change the cluster of our follower node
|
||||
-- queries should stat failing again, since there are no worker nodes in the new cluster
|
||||
|
||||
|
|
Loading…
Reference in New Issue