Add citus_nodes view tests

pull/4383/head
Marco Slot 2020-12-03 22:46:10 +01:00
parent 2e79f21276
commit 6728256f93
9 changed files with 106 additions and 2 deletions

View File

@ -36,6 +36,8 @@ SELECT
FROM
pg_dist_node n,
citus_node_disk_space_stats(n.nodename, n.nodeport) ds
WHERE
n.isactive AND nodecluster = current_setting('citus.cluster_name')
ORDER BY
groupid;

View File

@ -36,6 +36,8 @@ SELECT
FROM
pg_dist_node n,
citus_node_disk_space_stats(n.nodename, n.nodeport) ds
WHERE
n.isactive AND nodecluster = current_setting('citus.cluster_name')
ORDER BY
groupid;

View File

@ -998,3 +998,57 @@ WHERE logicalrelid = 'test_dist_non_colocated'::regclass GROUP BY nodeport ORDER
SELECT * from master_set_node_property('localhost', :worker_2_port, 'bogusproperty', false);
ERROR: only the 'shouldhaveshards' property can be set using this function
DROP TABLE test_dist, test_ref, test_dist_colocated, test_dist_non_colocated;
SELECT master_remove_node('localhost', 8887);
master_remove_node
---------------------------------------------------------------------
(1 row)
SELECT master_remove_node('localhost', 8888);
master_remove_node
---------------------------------------------------------------------
(1 row)
SELECT master_remove_node('localhost', 9992);
master_remove_node
---------------------------------------------------------------------
(1 row)
SELECT master_remove_node('localhost', 9994);
master_remove_node
---------------------------------------------------------------------
(1 row)
SELECT master_remove_node('localhost', 9995);
master_remove_node
---------------------------------------------------------------------
(1 row)
SELECT master_remove_node('localhost', 9996);
master_remove_node
---------------------------------------------------------------------
(1 row)
SELECT master_remove_node('localhost', 9997);
master_remove_node
---------------------------------------------------------------------
(1 row)
SELECT master_remove_node('localhost', 9998);
master_remove_node
---------------------------------------------------------------------
(1 row)
SELECT count(*) FROM pg_dist_node;
count
---------------------------------------------------------------------
2
(1 row)

View File

@ -515,6 +515,16 @@ ORDER BY "Name"::text;
supplier_mx | reference | <none> | 1 | postgres
(23 rows)
-- test the citus nodes view
SELECT "Host", "Port", "Node Type", "Distributed Table Shards", "Reference Tables"
FROM citus_nodes
ORDER BY 1,2;
Host | Port | Node Type | Distributed Table Shards | Reference Tables
---------------------------------------------------------------------
localhost | 57637 | worker | 55 | 4
localhost | 57638 | worker | 52 | 4
(2 rows)
\c - - - :worker_1_port
SELECT "Name", "Citus Table Type", "Distribution Column", "Shard Count", "Owner"
FROM citus_tables
@ -546,3 +556,12 @@ ORDER BY "Name"::text;
supplier_mx | reference | <none> | 1 | postgres
(23 rows)
SELECT "Host", "Port", "Node Type", "Distributed Table Shards", "Reference Tables"
FROM citus_nodes
ORDER BY 1,2;
Host | Port | Node Type | Distributed Table Shards | Reference Tables
---------------------------------------------------------------------
localhost | 57637 | worker | 55 | 4
localhost | 57638 | worker | 52 | 4
(2 rows)

View File

@ -131,6 +131,13 @@ SELECT citus_total_relation_size('supplier');
458752
(1 row)
-- mainly to get line coverage
SELECT citus_database_size() > 0;
?column?
---------------------------------------------------------------------
t
(1 row)
-- Test inside the transaction
BEGIN;
ALTER TABLE supplier ALTER COLUMN s_suppkey SET NOT NULL;

View File

@ -219,5 +219,5 @@ ORDER BY 1;
view citus_tables
view citus_worker_stat_activity
view pg_dist_shard_placement
(201 rows)
(203 rows)

View File

@ -415,3 +415,13 @@ WHERE logicalrelid = 'test_dist_non_colocated'::regclass GROUP BY nodeport ORDER
SELECT * from master_set_node_property('localhost', :worker_2_port, 'bogusproperty', false);
DROP TABLE test_dist, test_ref, test_dist_colocated, test_dist_non_colocated;
SELECT master_remove_node('localhost', 8887);
SELECT master_remove_node('localhost', 8888);
SELECT master_remove_node('localhost', 9992);
SELECT master_remove_node('localhost', 9994);
SELECT master_remove_node('localhost', 9995);
SELECT master_remove_node('localhost', 9996);
SELECT master_remove_node('localhost', 9997);
SELECT master_remove_node('localhost', 9998);
SELECT count(*) FROM pg_dist_node;

View File

@ -433,10 +433,17 @@ SELECT "Name", "Citus Table Type", "Distribution Column", "Shard Count", "Owner"
FROM citus_tables
ORDER BY "Name"::text;
-- test the citus nodes view
SELECT "Host", "Port", "Node Type", "Distributed Table Shards", "Reference Tables"
FROM citus_nodes
ORDER BY 1,2;
\c - - - :worker_1_port
SELECT "Name", "Citus Table Type", "Distribution Column", "Shard Count", "Owner"
FROM citus_tables
ORDER BY "Name"::text;
SELECT "Host", "Port", "Node Type", "Distributed Table Shards", "Reference Tables"
FROM citus_nodes
ORDER BY 1,2;

View File

@ -60,6 +60,9 @@ SELECT citus_table_size('supplier');
SELECT citus_relation_size('supplier');
SELECT citus_total_relation_size('supplier');
-- mainly to get line coverage
SELECT citus_database_size() > 0;
-- Test inside the transaction
BEGIN;
ALTER TABLE supplier ALTER COLUMN s_suppkey SET NOT NULL;