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