Fix MX tests

onder_view
Burak Velioglu 2022-04-12 22:57:57 +03:00
parent 6e5eb862a0
commit 9a0051b151
No known key found for this signature in database
GPG Key ID: F6827E620F6549C6
11 changed files with 38 additions and 2 deletions

View File

@ -683,11 +683,13 @@ SELECT count(*) FROM distributed_table WHERE b in
0
(1 row)
SET citus.enable_ddl_propagation TO OFF;
CREATE VIEW view_2 AS
SELECT count(*)
FROM citus_local_table
JOIN citus_local_table_2 USING (a)
JOIN distributed_table USING (a);
RESET citus.enable_ddl_propagation;
-- should fail as view contains direct local dist join
SELECT count(*) FROM view_2;
count
@ -695,11 +697,13 @@ SELECT count(*) FROM view_2;
1
(1 row)
SET citus.enable_ddl_propagation TO OFF;
CREATE VIEW view_3
AS SELECT count(*)
FROM citus_local_table_2
JOIN reference_table
USING (a);
RESET citus.enable_ddl_propagation;
-- ok
SELECT count(*) FROM view_3;
count

View File

@ -398,7 +398,9 @@ INSERT INTO distributed_table VALUES (1, '22', 20);
NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 (key, value, age) VALUES (1, '22'::text, 20)
INSERT INTO second_distributed_table VALUES (1, '1');
NOTICE: executing the command locally: INSERT INTO local_shard_execution.second_distributed_table_1470005 (key, value) VALUES (1, '1'::text)
SET citus.enable_ddl_propagation TO OFF;
CREATE VIEW abcd_view AS SELECT * FROM abcd;
RESET citus.enable_ddl_propagation;
SELECT * FROM abcd first join abcd second on first.b = second.b ORDER BY 1,2,3,4;
b | c | d | b | c | d
---------------------------------------------------------------------
@ -1656,8 +1658,10 @@ NOTICE: executing the command locally: DELETE FROM local_shard_execution.distri
ROLLBACK;
-- probably not a realistic case since views are not very
-- well supported with MX
SET citus.enable_ddl_propagation TO OFF;
CREATE VIEW v_local_query_execution AS
SELECT * FROM distributed_table WHERE key = 500;
RESET citus.enable_ddl_propagation;
SELECT * FROM v_local_query_execution;
NOTICE: executing the command locally: SELECT key, value, age FROM (SELECT distributed_table.key, distributed_table.value, distributed_table.age FROM local_shard_execution.distributed_table_1470003 distributed_table WHERE (distributed_table.key OPERATOR(pg_catalog.=) 500)) v_local_query_execution
key | value | age
@ -1667,8 +1671,10 @@ NOTICE: executing the command locally: SELECT key, value, age FROM (SELECT dist
-- similar test, but this time the view itself is a non-local
-- query, but the query on the view is local
SET citus.enable_ddl_propagation TO OFF;
CREATE VIEW v_local_query_execution_2 AS
SELECT * FROM distributed_table;
RESET citus.enable_ddl_propagation;
SELECT * FROM v_local_query_execution_2 WHERE key = 500;
NOTICE: executing the command locally: SELECT key, value, age FROM (SELECT distributed_table.key, distributed_table.value, distributed_table.age FROM local_shard_execution.distributed_table_1470003 distributed_table) v_local_query_execution_2 WHERE (key OPERATOR(pg_catalog.=) 500)
key | value | age

View File

@ -334,7 +334,9 @@ NOTICE: executing the command locally: SELECT key, value FROM local_shard_execu
-- Put row back for other tests
INSERT INTO distributed_table VALUES (1, '22', 20);
NOTICE: executing the command locally: INSERT INTO local_shard_execution_replicated.distributed_table_1500001 (key, value, age) VALUES (1, '22'::text, 20)
SET citus.enable_ddl_propagation TO OFF;
CREATE VIEW abcd_view AS SELECT * FROM abcd;
RESET citus.enable_ddl_propagation;
SELECT * FROM abcd first join abcd second on first.b = second.b ORDER BY 1,2,3,4;
b | c | d | b | c | d
---------------------------------------------------------------------
@ -1650,8 +1652,10 @@ NOTICE: executing the command locally: DELETE FROM local_shard_execution_replic
ROLLBACK;
-- probably not a realistic case since views are not very
-- well supported with MX
SET citus.enable_ddl_propagation TO OFF;
CREATE VIEW v_local_query_execution AS
SELECT * FROM distributed_table WHERE key = 500;
RESET citus.enable_ddl_propagation;
SELECT * FROM v_local_query_execution;
NOTICE: executing the command locally: SELECT key, value, age FROM (SELECT distributed_table.key, distributed_table.value, distributed_table.age FROM local_shard_execution_replicated.distributed_table_1500003 distributed_table WHERE (distributed_table.key OPERATOR(pg_catalog.=) 500)) v_local_query_execution
key | value | age
@ -1661,8 +1665,10 @@ NOTICE: executing the command locally: SELECT key, value, age FROM (SELECT dist
-- similar test, but this time the view itself is a non-local
-- query, but the query on the view is local
SET citus.enable_ddl_propagation TO OFF;
CREATE VIEW v_local_query_execution_2 AS
SELECT * FROM distributed_table;
RESET citus.enable_ddl_propagation;
SELECT * FROM v_local_query_execution_2 WHERE key = 500;
NOTICE: executing the command locally: SELECT key, value, age FROM (SELECT distributed_table.key, distributed_table.value, distributed_table.age FROM local_shard_execution_replicated.distributed_table_1500003 distributed_table) v_local_query_execution_2 WHERE (key OPERATOR(pg_catalog.=) 500)
key | value | age

View File

@ -110,6 +110,7 @@ WHERE
SET search_path TO recursive_dml_queries_mx, public;
CREATE TABLE recursive_dml_queries_mx.local_table (id text, name text);
INSERT INTO local_table SELECT i::text, 'user_' || i FROM generate_series (0, 100) i;
SET citus.enable_ddl_propagation TO OFF;
CREATE VIEW tenant_ids AS
SELECT
tenant_id, name
@ -118,6 +119,7 @@ CREATE VIEW tenant_ids AS
WHERE
distributed_table.dept::text = reference_table.id
ORDER BY 2 DESC, 1 DESC;
RESET citus.enable_ddl_propagation;
-- we currently do not allow local tables in modification queries
UPDATE
distributed_table

View File

@ -141,6 +141,8 @@ INSERT INTO sensors_news VALUES (DEFAULT, DEFAULT, '2021-01-01') RETURNING *;
\c - - - :master_port
SELECT 1 FROM citus_activate_node('localhost', :worker_1_port);
NOTICE: Replicating postgres objects to node localhost:xxxxx
DETAIL: There are 102 objects to replicate, depending on your environment this might take a while
?column?
---------------------------------------------------------------------
1

View File

@ -141,7 +141,6 @@ SELECT * FROM distributed_table_1;
---------------------------------------------------------------------
(0 rows)
CREATE VIEW test_view AS SELECT COUNT(*) FROM distributed_table_3;
CREATE MATERIALIZED VIEW test_matview AS SELECT COUNT(*) FROM distributed_table_3;
SELECT * FROM test_view;
count

View File

@ -445,20 +445,24 @@ SELECT count(*) FROM mat_view_4;
SELECT count(*) FROM distributed_table WHERE b in
(SELECT count FROM mat_view_4);
SET citus.enable_ddl_propagation TO OFF;
CREATE VIEW view_2 AS
SELECT count(*)
FROM citus_local_table
JOIN citus_local_table_2 USING (a)
JOIN distributed_table USING (a);
RESET citus.enable_ddl_propagation;
-- should fail as view contains direct local dist join
SELECT count(*) FROM view_2;
SET citus.enable_ddl_propagation TO OFF;
CREATE VIEW view_3
AS SELECT count(*)
FROM citus_local_table_2
JOIN reference_table
USING (a);
RESET citus.enable_ddl_propagation;
-- ok
SELECT count(*) FROM view_3;

View File

@ -230,7 +230,9 @@ SELECT * FROM second_distributed_table WHERE key = 1 ORDER BY 1,2;
INSERT INTO distributed_table VALUES (1, '22', 20);
INSERT INTO second_distributed_table VALUES (1, '1');
SET citus.enable_ddl_propagation TO OFF;
CREATE VIEW abcd_view AS SELECT * FROM abcd;
RESET citus.enable_ddl_propagation;
SELECT * FROM abcd first join abcd second on first.b = second.b ORDER BY 1,2,3,4;
@ -765,15 +767,19 @@ ROLLBACK;
-- probably not a realistic case since views are not very
-- well supported with MX
SET citus.enable_ddl_propagation TO OFF;
CREATE VIEW v_local_query_execution AS
SELECT * FROM distributed_table WHERE key = 500;
RESET citus.enable_ddl_propagation;
SELECT * FROM v_local_query_execution;
-- similar test, but this time the view itself is a non-local
-- query, but the query on the view is local
SET citus.enable_ddl_propagation TO OFF;
CREATE VIEW v_local_query_execution_2 AS
SELECT * FROM distributed_table;
RESET citus.enable_ddl_propagation;
SELECT * FROM v_local_query_execution_2 WHERE key = 500;

View File

@ -194,7 +194,9 @@ SELECT * FROM second_distributed_table WHERE key = 1 ORDER BY 1,2;
-- Put row back for other tests
INSERT INTO distributed_table VALUES (1, '22', 20);
SET citus.enable_ddl_propagation TO OFF;
CREATE VIEW abcd_view AS SELECT * FROM abcd;
RESET citus.enable_ddl_propagation;
SELECT * FROM abcd first join abcd second on first.b = second.b ORDER BY 1,2,3,4;
@ -729,15 +731,19 @@ ROLLBACK;
-- probably not a realistic case since views are not very
-- well supported with MX
SET citus.enable_ddl_propagation TO OFF;
CREATE VIEW v_local_query_execution AS
SELECT * FROM distributed_table WHERE key = 500;
RESET citus.enable_ddl_propagation;
SELECT * FROM v_local_query_execution;
-- similar test, but this time the view itself is a non-local
-- query, but the query on the view is local
SET citus.enable_ddl_propagation TO OFF;
CREATE VIEW v_local_query_execution_2 AS
SELECT * FROM distributed_table;
RESET citus.enable_ddl_propagation;
SELECT * FROM v_local_query_execution_2 WHERE key = 500;

View File

@ -104,6 +104,7 @@ SET search_path TO recursive_dml_queries_mx, public;
CREATE TABLE recursive_dml_queries_mx.local_table (id text, name text);
INSERT INTO local_table SELECT i::text, 'user_' || i FROM generate_series (0, 100) i;
SET citus.enable_ddl_propagation TO OFF;
CREATE VIEW tenant_ids AS
SELECT
tenant_id, name
@ -112,6 +113,7 @@ CREATE VIEW tenant_ids AS
WHERE
distributed_table.dept::text = reference_table.id
ORDER BY 2 DESC, 1 DESC;
RESET citus.enable_ddl_propagation;
-- we currently do not allow local tables in modification queries
UPDATE

View File

@ -103,7 +103,6 @@ SELECT start_metadata_sync_to_node('localhost', :worker_1_port);
\c - - - :worker_1_port
SET search_path TO "start_stop_metadata_sync";
SELECT * FROM distributed_table_1;
CREATE VIEW test_view AS SELECT COUNT(*) FROM distributed_table_3;
CREATE MATERIALIZED VIEW test_matview AS SELECT COUNT(*) FROM distributed_table_3;
SELECT * FROM test_view;
SELECT * FROM test_matview;