Tests pass

pull/801/head
Brian Cloutier 2016-09-22 18:18:00 +03:00
parent 4a6348accc
commit f521ffefa8
9 changed files with 45 additions and 75 deletions

View File

@ -7,7 +7,7 @@ MODULE_big = citus
EXTENSION = citus
EXTVERSIONS = 5.0 5.0-1 5.0-2 \
5.1-1 5.1-2 5.1-3 5.1-4 5.1-5 5.1-6 5.1-7 5.1-8 \
5.2-1
5.2-1 5.3-1
# All citus--*.sql files in the source directory
DATA = $(patsubst $(citus_abs_srcdir)/%.sql,%.sql,$(wildcard $(citus_abs_srcdir)/$(EXTENSION)--*--*.sql))
@ -52,6 +52,8 @@ $(EXTENSION)--5.1-8.sql: $(EXTENSION)--5.1-7.sql $(EXTENSION)--5.1-7--5.1-8.sql
cat $^ > $@
$(EXTENSION)--5.2-1.sql: $(EXTENSION)--5.1-8.sql $(EXTENSION)--5.1-8--5.2-1.sql
cat $^ > $@
$(EXTENSION)--5.3-1.sql: $(EXTENSION)--5.2-1.sql $(EXTENSION)--5.2-1--5.3-1.sql
cat $^ > $@
NO_PGXS = 1

View File

@ -10,7 +10,7 @@ CREATE TABLE citus.pg_dist_node(
UNIQUE (nodename, nodeport)
);
CREATE SEQUENCE citus.pg_dist_gropuid_seq
CREATE SEQUENCE citus.pg_dist_groupid_seq
MINVALUE 1
MAXVALUE 4294967296;
@ -19,7 +19,7 @@ CREATE SEQUENCE citus.pg_dist_node_nodeid_seq
MAXVALUE 4294967296;
ALTER TABLE citus.pg_dist_node SET SCHEMA pg_catalog;
ALTER SEQUENCE citus.pg_dist_gropuid_seq SET SCHEMA pg_catalog;
ALTER SEQUENCE citus.pg_dist_groupid_seq SET SCHEMA pg_catalog;
ALTER SEQUENCE citus.pg_dist_node_nodeid_seq SET SCHEMA pg_catalog;
CREATE FUNCTION master_dist_node_cache_invalidate()

View File

@ -1,6 +1,6 @@
# Citus extension
comment = 'Citus distributed database'
default_version = '5.2-1'
default_version = '5.3-1'
module_pathname = '$libdir/citus'
relocatable = false
schema = pg_catalog

View File

@ -51,7 +51,8 @@ static List * ParseWorkerNodeFile(const char *workerNodeFilename);
/* declarations for dynamic loading */
PG_FUNCTION_INFO_V1(cluster_add_node);
PG_FUNCTION_INFO_V1(cluster_read_worker_file);
PG_FUNCTION_INFO_V1(cluster_remove_node);
PG_FUNCTION_INFO_V1(cluster_initialize_node_metadata);
PG_FUNCTION_INFO_V1(master_get_new_nodeid);
PG_FUNCTION_INFO_V1(master_get_next_groupid);
@ -125,11 +126,23 @@ cluster_add_node(PG_FUNCTION_ARGS)
}
Datum
cluster_remove_node(PG_FUNCTION_ARGS)
{
text *nodeName = PG_GETARG_TEXT_P(0);
int32 nodePort = PG_GETARG_INT32(1);
PG_RETURN_VOID();
}
/*
*/
Datum
cluster_read_worker_file(PG_FUNCTION_ARGS)
cluster_initialize_node_metadata(PG_FUNCTION_ARGS)
{
PG_RETURN_BOOL(true);
/*
text *filePath = PG_GETARG_TEXT_P(0);
char *filePathCStr = text_to_cstring(filePath);
@ -147,6 +160,7 @@ cluster_read_worker_file(PG_FUNCTION_ARGS)
}
PG_RETURN_BOOL(true);
*/
}

View File

@ -1,15 +1,15 @@
-- Tests functions related to cluster membership
-- add the nodes to the cluster
SELECT cluster_add_node('localhost', :worker_1_port);
cluster_add_node
---------------------------
(1,p,t,1,localhost,57637)
cluster_add_node
-----------------------
(1,1,localhost,57637)
(1 row)
SELECT cluster_add_node('localhost', :worker_2_port);
cluster_add_node
---------------------------
(2,p,t,2,localhost,57638)
cluster_add_node
-----------------------
(2,2,localhost,57638)
(1 row)
-- get the active nodes
@ -20,42 +20,11 @@ SELECT master_get_active_worker_nodes();
(localhost,57637)
(2 rows)
-- de-activate a node
SELECT cluster_deactivate_node('localhost', :worker_1_port);
cluster_deactivate_node
-------------------------
t
(1 row)
-- try to add the node again when it is de-activated
SELECT cluster_add_node('localhost', :worker_1_port);
cluster_add_node
---------------------------
(1,p,f,1,localhost,57637)
(1 row)
-- get the active nodes again to see deactivation
SELECT master_get_active_worker_nodes();
master_get_active_worker_nodes
--------------------------------
(localhost,57638)
(1 row)
-- we cannot de-activate a node that is already de-activated
SELECT cluster_deactivate_node('localhost', :worker_1_port);
ERROR: node is already deactivated
-- activate it again
SELECT cluster_activate_node('localhost', :worker_1_port);
cluster_activate_node
-----------------------
t
(1 row)
-- try to add the node again when it is activated
SELECT cluster_add_node('localhost', :worker_1_port);
cluster_add_node
---------------------------
(1,p,t,1,localhost,57637)
cluster_add_node
-----------------------
(1,1,localhost,57637)
(1 row)
-- get the active nodes

View File

@ -21,15 +21,15 @@ 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
---------------------------
(1,p,t,1,localhost,57637)
cluster_add_node
-----------------------
(1,1,localhost,57637)
(1 row)
SELECT cluster_add_node('localhost', :worker_2_port);
cluster_add_node
---------------------------
(2,p,t,2,localhost,57638)
cluster_add_node
-----------------------
(2,2,localhost,57638)
(1 row)
-- verify that a table can be created after the extension has been dropped and recreated

View File

@ -1534,7 +1534,7 @@ DROP MATERIALIZED VIEW mv_articles_hash;
DEBUG: drop auto-cascades to type mv_articles_hash
DEBUG: drop auto-cascades to type mv_articles_hash[]
DEBUG: drop auto-cascades to rule _RETURN on materialized view mv_articles_hash
DEBUG: EventTriggerInvoke 16727
DEBUG: EventTriggerInvoke 16763
CREATE MATERIALIZED VIEW mv_articles_hash_error AS
SELECT * FROM articles_hash WHERE author_id in (1,2);
NOTICE: cannot use shard pruning with ANY/ALL (array expression)

View File

@ -67,15 +67,15 @@ DROP EXTENSION citus;
CREATE EXTENSION citus;
-- re-add the nodes to the cluster
SELECT cluster_add_node('localhost', :worker_1_port);
cluster_add_node
---------------------------
(1,p,t,1,localhost,57637)
cluster_add_node
-----------------------
(1,1,localhost,57637)
(1 row)
SELECT cluster_add_node('localhost', :worker_2_port);
cluster_add_node
---------------------------
(2,p,t,2,localhost,57638)
cluster_add_node
-----------------------
(2,2,localhost,57638)
(1 row)
-- create a table with a SERIAL column

View File

@ -7,23 +7,8 @@ SELECT cluster_add_node('localhost', :worker_2_port);
-- get the active nodes
SELECT master_get_active_worker_nodes();
-- de-activate a node
SELECT cluster_deactivate_node('localhost', :worker_1_port);
-- try to add the node again when it is de-activated
SELECT cluster_add_node('localhost', :worker_1_port);
-- get the active nodes again to see deactivation
SELECT master_get_active_worker_nodes();
-- we cannot de-activate a node that is already de-activated
SELECT cluster_deactivate_node('localhost', :worker_1_port);
-- activate it again
SELECT cluster_activate_node('localhost', :worker_1_port);
-- try to add the node again when it is activated
SELECT cluster_add_node('localhost', :worker_1_port);
-- get the active nodes
SELECT master_get_active_worker_nodes();
SELECT master_get_active_worker_nodes();