Skip to content

Commit

Permalink
Make data nodes view consistent with other views
Browse files Browse the repository at this point in the history
Rename the data_node view to data_nodes to be consistent with other
views that all use the plural form.
  • Loading branch information
erimatnor committed Oct 5, 2020
1 parent 5a5cbe1 commit 7a406fa
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion sql/views.sql
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ CREATE OR REPLACE VIEW timescaledb_information.continuous_aggregates as
and N.nspname = cagg.direct_view_schema ) directview
WHERE cagg.mat_hypertable_id = ht.id;

CREATE OR REPLACE VIEW timescaledb_information.data_node AS
CREATE OR REPLACE VIEW timescaledb_information.data_nodes AS
SELECT s.node_name, s.owner, s.options
FROM (SELECT srvname AS node_name, srvowner::regrole::name AS owner, srvoptions AS options
FROM pg_catalog.pg_foreign_server AS srv, pg_catalog.pg_foreign_data_wrapper AS fdw
Expand Down
2 changes: 1 addition & 1 deletion test/expected/pg_dump.out
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ WHERE refclassid = 'pg_catalog.pg_extension'::pg_catalog.regclass AND
timescaledb_information.compression_settings
timescaledb_information.dimensions
timescaledb_information.chunks
timescaledb_information.data_node
timescaledb_information.data_nodes
timescaledb_information.continuous_aggregates
timescaledb_information.jobs
timescaledb_information.job_stats
Expand Down
16 changes: 8 additions & 8 deletions tsl/test/expected/data_node.out
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ ALTER SERVER data_node_1 OWNER TO CURRENT_USER;
ERROR: alter owner not supported on a TimescaleDB data node
\set ON_ERROR_STOP 1
-- List foreign data nodes
SELECT node_name, "options" FROM timescaledb_information.data_node ORDER BY node_name;
SELECT node_name, "options" FROM timescaledb_information.data_nodes ORDER BY node_name;
node_name | options
-------------+------------------------------------------------
data_node_1 | {host=localhost,port=55432,dbname=data_node_1}
Expand All @@ -107,7 +107,7 @@ SELECT * FROM delete_data_node('data_node_3');
(1 row)

-- List data nodes
SELECT node_name, "options" FROM timescaledb_information.data_node ORDER BY node_name;
SELECT node_name, "options" FROM timescaledb_information.data_nodes ORDER BY node_name;
node_name | options
-------------+------------------------------------------------
data_node_1 | {host=localhost,port=55432,dbname=data_node_1}
Expand All @@ -127,7 +127,7 @@ NOTICE: data node "data_node_3" does not exist, skipping
f
(1 row)

SELECT node_name, "options" FROM timescaledb_information.data_node ORDER BY node_name;
SELECT node_name, "options" FROM timescaledb_information.data_nodes ORDER BY node_name;
node_name | options
-------------+------------------------------------------------
data_node_1 | {host=localhost,port=55432,dbname=data_node_1}
Expand All @@ -147,7 +147,7 @@ SELECT * FROM delete_data_node('data_node_2');
(1 row)

-- No data nodes left
SELECT node_name, "options" FROM timescaledb_information.data_node ORDER BY node_name;
SELECT node_name, "options" FROM timescaledb_information.data_nodes ORDER BY node_name;
node_name | options
-----------+---------
(0 rows)
Expand Down Expand Up @@ -188,7 +188,7 @@ GRANT USAGE
ON FOREIGN SERVER data_node_1, data_node_2
TO :ROLE_1;
SELECT node_name, "options"
FROM timescaledb_information.data_node
FROM timescaledb_information.data_nodes
ORDER BY node_name;
node_name | options
-------------+------------------------------------------------
Expand Down Expand Up @@ -322,7 +322,7 @@ replication_factor
-- Create one chunk
INSERT INTO disttable VALUES ('2019-02-02 10:45', 1, 23.4);
-- Chunk mapping created
SELECT node_name, "options" FROM timescaledb_information.data_node ORDER BY node_name;
SELECT node_name, "options" FROM timescaledb_information.data_nodes ORDER BY node_name;
node_name | options
-------------+------------------------------------------------
data_node_1 | {host=localhost,port=55432,dbname=data_node_1}
Expand Down Expand Up @@ -720,7 +720,7 @@ SELECT * FROM delete_data_node('data_node_1');
t
(1 row)

SELECT node_name, "options" FROM timescaledb_information.data_node ORDER BY node_name;
SELECT node_name, "options" FROM timescaledb_information.data_nodes ORDER BY node_name;
node_name | options
-----------+---------
(0 rows)
Expand Down Expand Up @@ -756,7 +756,7 @@ DROP DATABASE data_node_2;
DROP DATABASE data_node_3;
DROP DATABASE data_node_4;
-- there should be no data nodes
SELECT node_name, "options" FROM timescaledb_information.data_node ORDER BY node_name;
SELECT node_name, "options" FROM timescaledb_information.data_nodes ORDER BY node_name;
node_name | options
-----------+---------
(0 rows)
Expand Down
4 changes: 2 additions & 2 deletions tsl/test/expected/dist_hypertable-11.out
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ GRANT USAGE ON FOREIGN SERVER :DATA_NODE_1, :DATA_NODE_2, :DATA_NODE_3 TO PUBLIC
\unset ECHO
SET ROLE :ROLE_1;
-- Verify lack of tables
SELECT node_name, "options" FROM timescaledb_information.data_node ORDER BY node_name;
SELECT node_name, "options" FROM timescaledb_information.data_nodes ORDER BY node_name;
node_name | options
-------------------+------------------------------------------------------
dist_hypertable_1 | {host=localhost,port=55432,dbname=dist_hypertable_1}
Expand Down Expand Up @@ -363,7 +363,7 @@ Sun Jul 01 08:01:00 2018 PDT| 29| 1.5

(1 row)

SELECT node_name, "options" FROM timescaledb_information.data_node ORDER BY node_name;
SELECT node_name, "options" FROM timescaledb_information.data_nodes ORDER BY node_name;
node_name | options
-------------------+------------------------------------------------------
dist_hypertable_1 | {host=localhost,port=55432,dbname=dist_hypertable_1}
Expand Down
4 changes: 2 additions & 2 deletions tsl/test/expected/dist_hypertable-12.out
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ GRANT USAGE ON FOREIGN SERVER :DATA_NODE_1, :DATA_NODE_2, :DATA_NODE_3 TO PUBLIC
\unset ECHO
SET ROLE :ROLE_1;
-- Verify lack of tables
SELECT node_name, "options" FROM timescaledb_information.data_node ORDER BY node_name;
SELECT node_name, "options" FROM timescaledb_information.data_nodes ORDER BY node_name;
node_name | options
-------------------+------------------------------------------------------
dist_hypertable_1 | {host=localhost,port=55432,dbname=dist_hypertable_1}
Expand Down Expand Up @@ -363,7 +363,7 @@ Sun Jul 01 08:01:00 2018 PDT| 29| 1.5

(1 row)

SELECT node_name, "options" FROM timescaledb_information.data_node ORDER BY node_name;
SELECT node_name, "options" FROM timescaledb_information.data_nodes ORDER BY node_name;
node_name | options
-------------------+------------------------------------------------------
dist_hypertable_1 | {host=localhost,port=55432,dbname=dist_hypertable_1}
Expand Down
2 changes: 1 addition & 1 deletion tsl/test/expected/dist_util.out
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ INSERT INTO disttable VALUES
('2018-01-02 08:01', 2, 1.3),
('2019-01-01 09:11', 3, 2.1),
('2017-01-01 06:05', 1, 1.4);
SELECT * FROM timescaledb_information.data_node ORDER BY node_name;
SELECT * FROM timescaledb_information.data_nodes ORDER BY node_name;
node_name | owner | options
-------------+--------------------+------------------------------------------------
data_node_1 | cluster_super_user | {host=localhost,port=55432,dbname=backend_2_1}
Expand Down
16 changes: 8 additions & 8 deletions tsl/test/sql/data_node.sql
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ ALTER SERVER data_node_1 OWNER TO CURRENT_USER;
\set ON_ERROR_STOP 1

-- List foreign data nodes
SELECT node_name, "options" FROM timescaledb_information.data_node ORDER BY node_name;
SELECT node_name, "options" FROM timescaledb_information.data_nodes ORDER BY node_name;

-- Delete a data node
SELECT * FROM delete_data_node('data_node_3');

-- List data nodes
SELECT node_name, "options" FROM timescaledb_information.data_node ORDER BY node_name;
SELECT node_name, "options" FROM timescaledb_information.data_nodes ORDER BY node_name;

\set ON_ERROR_STOP 0
-- Deleting a non-existing data node generates error
Expand All @@ -87,13 +87,13 @@ SELECT * FROM delete_data_node('data_node_3');
-- Deleting non-existing data node with "if_exists" set does not generate error
SELECT * FROM delete_data_node('data_node_3', if_exists => true);

SELECT node_name, "options" FROM timescaledb_information.data_node ORDER BY node_name;
SELECT node_name, "options" FROM timescaledb_information.data_nodes ORDER BY node_name;

SELECT * FROM delete_data_node('data_node_1');
SELECT * FROM delete_data_node('data_node_2');

-- No data nodes left
SELECT node_name, "options" FROM timescaledb_information.data_node ORDER BY node_name;
SELECT node_name, "options" FROM timescaledb_information.data_nodes ORDER BY node_name;

-- Cleanup databases
RESET ROLE;
Expand All @@ -119,7 +119,7 @@ GRANT USAGE
TO :ROLE_1;

SELECT node_name, "options"
FROM timescaledb_information.data_node
FROM timescaledb_information.data_nodes
ORDER BY node_name;

SELECT object_name, object_type, ARRAY_AGG(privilege_type)
Expand Down Expand Up @@ -182,7 +182,7 @@ FROM _timescaledb_catalog.hypertable WHERE table_name = 'disttable'; $$);
INSERT INTO disttable VALUES ('2019-02-02 10:45', 1, 23.4);

-- Chunk mapping created
SELECT node_name, "options" FROM timescaledb_information.data_node ORDER BY node_name;
SELECT node_name, "options" FROM timescaledb_information.data_nodes ORDER BY node_name;

DROP TABLE disttable;

Expand Down Expand Up @@ -380,7 +380,7 @@ SELECT * FROM create_distributed_hypertable('disttable', 'time', data_nodes => '

SET ROLE :ROLE_CLUSTER_SUPERUSER;
SELECT * FROM delete_data_node('data_node_1');
SELECT node_name, "options" FROM timescaledb_information.data_node ORDER BY node_name;
SELECT node_name, "options" FROM timescaledb_information.data_nodes ORDER BY node_name;

SELECT * FROM test.show_subtables('disttable');
SELECT * FROM _timescaledb_catalog.hypertable_data_node;
Expand All @@ -399,7 +399,7 @@ DROP DATABASE data_node_3;
DROP DATABASE data_node_4;

-- there should be no data nodes
SELECT node_name, "options" FROM timescaledb_information.data_node ORDER BY node_name;
SELECT node_name, "options" FROM timescaledb_information.data_nodes ORDER BY node_name;

-- let's add some
SELECT * FROM add_data_node('data_node_1', host => 'localhost',
Expand Down
4 changes: 2 additions & 2 deletions tsl/test/sql/dist_hypertable.sql.in
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ SET client_min_messages TO NOTICE;
SET ROLE :ROLE_1;

-- Verify lack of tables
SELECT node_name, "options" FROM timescaledb_information.data_node ORDER BY node_name;
SELECT node_name, "options" FROM timescaledb_information.data_nodes ORDER BY node_name;

\set ON_ERROR_STOP 0
-- Test that one cannot directly create TimescaleDB foreign tables
Expand Down Expand Up @@ -187,7 +187,7 @@ SELECT * FROM test.remote_exec(ARRAY[:'DATA_NODE_1', :'DATA_NODE_2', :'DATA_NODE
SELECT * FROM disttable;
$$);

SELECT node_name, "options" FROM timescaledb_information.data_node ORDER BY node_name;
SELECT node_name, "options" FROM timescaledb_information.data_nodes ORDER BY node_name;
SELECT * FROM hypertable_detailed_size('disttable') ORDER BY node_name;

-- Show what some queries would look like on the frontend
Expand Down
2 changes: 1 addition & 1 deletion tsl/test/sql/dist_util.sql
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ INSERT INTO disttable VALUES
('2019-01-01 09:11', 3, 2.1),
('2017-01-01 06:05', 1, 1.4);

SELECT * FROM timescaledb_information.data_node ORDER BY node_name;
SELECT * FROM timescaledb_information.data_nodes ORDER BY node_name;
SELECT * FROM timescaledb_information.hypertables;
SELECT * FROM hypertable_detailed_size('disttable') ORDER BY node_name;
SELECT * FROM hypertable_detailed_size('nondisttable') ORDER BY node_name;
Expand Down

0 comments on commit 7a406fa

Please sign in to comment.