mirror of https://github.com/citusdata/citus.git
cluster_ -> master_
parent
ee83df8990
commit
fcd418214e
|
@ -33,30 +33,30 @@ CREATE TRIGGER dist_node_cache_invalidate
|
|||
ON pg_catalog.pg_dist_node
|
||||
FOR EACH ROW EXECUTE PROCEDURE master_dist_node_cache_invalidate();
|
||||
|
||||
CREATE FUNCTION cluster_add_node(nodename text,
|
||||
nodeport integer,
|
||||
groupid integer DEFAULT 0)
|
||||
CREATE FUNCTION master_add_node(nodename text,
|
||||
nodeport integer,
|
||||
groupid integer DEFAULT 0)
|
||||
RETURNS record
|
||||
LANGUAGE C STRICT
|
||||
AS 'MODULE_PATHNAME', $$cluster_add_node$$;
|
||||
COMMENT ON FUNCTION cluster_add_node(nodename text,
|
||||
nodeport integer,
|
||||
groupid integer)
|
||||
AS 'MODULE_PATHNAME', $$master_add_node$$;
|
||||
COMMENT ON FUNCTION master_add_node(nodename text,
|
||||
nodeport integer,
|
||||
groupid integer)
|
||||
IS 'add node to the cluster';
|
||||
|
||||
CREATE FUNCTION cluster_remove_node(nodename text, nodeport integer)
|
||||
CREATE FUNCTION master_remove_node(nodename text, nodeport integer)
|
||||
RETURNS void
|
||||
LANGUAGE C STRICT
|
||||
AS 'MODULE_PATHNAME', $$cluster_remove_node$$;
|
||||
COMMENT ON FUNCTION cluster_remove_node(nodename text, nodeport integer)
|
||||
AS 'MODULE_PATHNAME', $$master_remove_node$$;
|
||||
COMMENT ON FUNCTION master_remove_node(nodename text, nodeport integer)
|
||||
IS 'remove node from the cluster';
|
||||
|
||||
/* this only needs to run once, now. */
|
||||
CREATE FUNCTION cluster_initialize_node_metadata()
|
||||
CREATE FUNCTION master_initialize_node_metadata()
|
||||
RETURNS BOOL
|
||||
LANGUAGE C STRICT
|
||||
AS 'MODULE_PATHNAME', $$cluster_initialize_node_metadata$$;
|
||||
AS 'MODULE_PATHNAME', $$master_initialize_node_metadata$$;
|
||||
|
||||
SELECT cluster_initialize_node_metadata();
|
||||
SELECT master_initialize_node_metadata();
|
||||
|
||||
RESET search_path;
|
||||
|
|
|
@ -49,15 +49,15 @@ static uint64 GetNodeCountInGroup(uint32 groupId);
|
|||
static List * ParseWorkerNodeFile(const char *workerNodeFilename);
|
||||
|
||||
/* declarations for dynamic loading */
|
||||
PG_FUNCTION_INFO_V1(cluster_add_node);
|
||||
PG_FUNCTION_INFO_V1(cluster_remove_node);
|
||||
PG_FUNCTION_INFO_V1(cluster_initialize_node_metadata);
|
||||
PG_FUNCTION_INFO_V1(master_add_node);
|
||||
PG_FUNCTION_INFO_V1(master_remove_node);
|
||||
PG_FUNCTION_INFO_V1(master_initialize_node_metadata);
|
||||
PG_FUNCTION_INFO_V1(master_get_new_nodeid);
|
||||
PG_FUNCTION_INFO_V1(master_get_next_groupid);
|
||||
|
||||
|
||||
/*
|
||||
* cluster_add_node function adds a new node to the cluster. If the node already
|
||||
* master_add_node function adds a new node to the cluster. If the node already
|
||||
* exists, the function returns with the information about the node. If not, the
|
||||
* following prodecure is followed while adding a node.
|
||||
* If the groupId is not explicitly given by the user, the function picks the
|
||||
|
@ -65,7 +65,7 @@ PG_FUNCTION_INFO_V1(master_get_next_groupid);
|
|||
* new node is inserted into the local pg_dist_node.
|
||||
*/
|
||||
Datum
|
||||
cluster_add_node(PG_FUNCTION_ARGS)
|
||||
master_add_node(PG_FUNCTION_ARGS)
|
||||
{
|
||||
text *nodeName = PG_GETARG_TEXT_P(0);
|
||||
int32 nodePort = PG_GETARG_INT32(1);
|
||||
|
@ -126,7 +126,7 @@ cluster_add_node(PG_FUNCTION_ARGS)
|
|||
|
||||
|
||||
Datum
|
||||
cluster_remove_node(PG_FUNCTION_ARGS)
|
||||
master_remove_node(PG_FUNCTION_ARGS)
|
||||
{
|
||||
text *nodeName = PG_GETARG_TEXT_P(0);
|
||||
int32 nodePort = PG_GETARG_INT32(1);
|
||||
|
@ -145,12 +145,12 @@ cluster_remove_node(PG_FUNCTION_ARGS)
|
|||
|
||||
|
||||
/*
|
||||
* cluster_initialize_node_metadata is run once, when upgrading citus. It injests the
|
||||
* master_initialize_node_metadata is run once, when upgrading citus. It injests the
|
||||
* existing pg_worker_list.conf into pg_dist_node, then adds a header to the file stating
|
||||
* that it's no longer used.
|
||||
*/
|
||||
Datum
|
||||
cluster_initialize_node_metadata(PG_FUNCTION_ARGS)
|
||||
master_initialize_node_metadata(PG_FUNCTION_ARGS)
|
||||
{
|
||||
ListCell *workerNodeCell = NULL;
|
||||
List *workerNodes = ParseWorkerNodeFile("pg_worker_list.conf");
|
||||
|
@ -160,7 +160,7 @@ cluster_initialize_node_metadata(PG_FUNCTION_ARGS)
|
|||
WorkerNode *workerNode = (WorkerNode *) lfirst(workerNodeCell);
|
||||
Datum workerNameDatum = PointerGetDatum(cstring_to_text(workerNode->workerName));
|
||||
|
||||
DirectFunctionCall3(cluster_add_node, workerNameDatum,
|
||||
DirectFunctionCall3(master_add_node, workerNameDatum,
|
||||
UInt32GetDatum(workerNode->workerPort),
|
||||
PointerGetDatum(NULL));
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
-- Tests functions related to cluster membership
|
||||
-- add the nodes to the cluster
|
||||
SELECT cluster_add_node('localhost', :worker_1_port);
|
||||
cluster_add_node
|
||||
SELECT master_add_node('localhost', :worker_1_port);
|
||||
master_add_node
|
||||
-----------------------
|
||||
(1,1,localhost,57637)
|
||||
(1 row)
|
||||
|
||||
SELECT cluster_add_node('localhost', :worker_2_port);
|
||||
cluster_add_node
|
||||
SELECT master_add_node('localhost', :worker_2_port);
|
||||
master_add_node
|
||||
-----------------------
|
||||
(2,2,localhost,57638)
|
||||
(1 row)
|
||||
|
@ -21,8 +21,8 @@ SELECT master_get_active_worker_nodes();
|
|||
(2 rows)
|
||||
|
||||
-- try to add the node again when it is activated
|
||||
SELECT cluster_add_node('localhost', :worker_1_port);
|
||||
cluster_add_node
|
||||
SELECT master_add_node('localhost', :worker_1_port);
|
||||
master_add_node
|
||||
-----------------------
|
||||
(1,1,localhost,57637)
|
||||
(1 row)
|
||||
|
|
|
@ -20,14 +20,14 @@ DROP EXTENSION citus CASCADE;
|
|||
RESET client_min_messages;
|
||||
CREATE EXTENSION citus;
|
||||
-- re-add the nodes to the cluster
|
||||
SELECT cluster_add_node('localhost', :worker_1_port);
|
||||
cluster_add_node
|
||||
SELECT master_add_node('localhost', :worker_1_port);
|
||||
master_add_node
|
||||
-----------------------
|
||||
(1,1,localhost,57637)
|
||||
(1 row)
|
||||
|
||||
SELECT cluster_add_node('localhost', :worker_2_port);
|
||||
cluster_add_node
|
||||
SELECT master_add_node('localhost', :worker_2_port);
|
||||
master_add_node
|
||||
-----------------------
|
||||
(2,2,localhost,57638)
|
||||
(1 row)
|
||||
|
|
|
@ -66,14 +66,14 @@ SELECT * FROM pg_dist_shard_placement;
|
|||
DROP EXTENSION citus;
|
||||
CREATE EXTENSION citus;
|
||||
-- re-add the nodes to the cluster
|
||||
SELECT cluster_add_node('localhost', :worker_1_port);
|
||||
cluster_add_node
|
||||
SELECT master_add_node('localhost', :worker_1_port);
|
||||
master_add_node
|
||||
-----------------------
|
||||
(1,1,localhost,57637)
|
||||
(1 row)
|
||||
|
||||
SELECT cluster_add_node('localhost', :worker_2_port);
|
||||
cluster_add_node
|
||||
SELECT master_add_node('localhost', :worker_2_port);
|
||||
master_add_node
|
||||
-----------------------
|
||||
(2,2,localhost,57638)
|
||||
(1 row)
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
-- Tests functions related to cluster membership
|
||||
|
||||
-- add the nodes to the cluster
|
||||
SELECT cluster_add_node('localhost', :worker_1_port);
|
||||
SELECT cluster_add_node('localhost', :worker_2_port);
|
||||
SELECT master_add_node('localhost', :worker_1_port);
|
||||
SELECT master_add_node('localhost', :worker_2_port);
|
||||
|
||||
-- get the active nodes
|
||||
SELECT master_get_active_worker_nodes();
|
||||
|
||||
-- try to add the node again when it is activated
|
||||
SELECT cluster_add_node('localhost', :worker_1_port);
|
||||
SELECT master_add_node('localhost', :worker_1_port);
|
||||
|
||||
-- get the active nodes
|
||||
SELECT master_get_active_worker_nodes();
|
||||
|
|
|
@ -22,8 +22,8 @@ RESET client_min_messages;
|
|||
CREATE EXTENSION citus;
|
||||
|
||||
-- re-add the nodes to the cluster
|
||||
SELECT cluster_add_node('localhost', :worker_1_port);
|
||||
SELECT cluster_add_node('localhost', :worker_2_port);
|
||||
SELECT master_add_node('localhost', :worker_1_port);
|
||||
SELECT master_add_node('localhost', :worker_2_port);
|
||||
|
||||
-- verify that a table can be created after the extension has been dropped and recreated
|
||||
CREATE TABLE testtableddl(somecol int, distributecol text NOT NULL);
|
||||
|
|
|
@ -46,8 +46,8 @@ DROP EXTENSION citus;
|
|||
CREATE EXTENSION citus;
|
||||
|
||||
-- re-add the nodes to the cluster
|
||||
SELECT cluster_add_node('localhost', :worker_1_port);
|
||||
SELECT cluster_add_node('localhost', :worker_2_port);
|
||||
SELECT master_add_node('localhost', :worker_1_port);
|
||||
SELECT master_add_node('localhost', :worker_2_port);
|
||||
|
||||
-- create a table with a SERIAL column
|
||||
CREATE TABLE testserialtable(id serial, group_id integer);
|
||||
|
|
Loading…
Reference in New Issue