Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flaky multi_mx_schema_support test #6813

Merged
merged 1 commit into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/test/regress/citus_tests/run_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ def extra_tests(self):
"multi_mx_modifying_xacts": TestDeps(None, ["multi_mx_create_table"]),
"multi_mx_router_planner": TestDeps(None, ["multi_mx_create_table"]),
"multi_mx_copy_data": TestDeps(None, ["multi_mx_create_table"]),
"multi_mx_schema_support": TestDeps(None, ["multi_mx_copy_data"]),
"multi_simple_queries": TestDeps("base_schedule"),
}

Expand Down
20 changes: 13 additions & 7 deletions src/test/regress/expected/multi_mx_schema_support.out
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ FETCH BACKWARD test_cursor;
END;
-- test inserting to table in different schema
SET search_path TO public;
DELETE from citus_mx_test_schema.nation_hash where n_nationkey = 100; -- allow rerunning this file
INSERT INTO citus_mx_test_schema.nation_hash(n_nationkey, n_name, n_regionkey) VALUES (100, 'TURKEY', 3);
-- verify insertion
SELECT * FROM citus_mx_test_schema.nation_hash WHERE n_nationkey = 100;
Expand All @@ -84,6 +85,7 @@ SELECT * FROM citus_mx_test_schema.nation_hash WHERE n_nationkey = 100;

-- test with search_path is set
SET search_path TO citus_mx_test_schema;
DELETE from nation_hash where n_nationkey = 101; -- allow rerunning this file
INSERT INTO nation_hash(n_nationkey, n_name, n_regionkey) VALUES (101, 'GERMANY', 3);
-- verify insertion
SELECT * FROM nation_hash WHERE n_nationkey = 101;
Expand Down Expand Up @@ -458,14 +460,14 @@ SELECT create_distributed_table('mx_old_schema.table_set_schema', 'id');
(1 row)

CREATE SCHEMA mx_new_schema;
SELECT objid::oid::regnamespace as "Distributed Schemas"
SELECT objid::oid::regnamespace::text as "Distributed Schemas"
FROM pg_catalog.pg_dist_object
WHERE objid::oid::regnamespace IN ('mx_old_schema', 'mx_new_schema')
ORDER BY "Distributed Schemas";
Distributed Schemas
---------------------------------------------------------------------
mx_old_schema
mx_new_schema
mx_old_schema
(2 rows)

\c - - - :worker_1_port
Expand All @@ -490,13 +492,14 @@ ERROR: operation is not allowed on this node
HINT: Connect to the coordinator and run it again.
\c - - - :master_port
ALTER TABLE mx_old_schema.table_set_schema SET SCHEMA mx_new_schema;
SELECT objid::oid::regnamespace as "Distributed Schemas"
SELECT objid::oid::regnamespace::text as "Distributed Schemas"
FROM pg_catalog.pg_dist_object
WHERE objid::oid::regnamespace IN ('mx_old_schema', 'mx_new_schema');
WHERE objid::oid::regnamespace IN ('mx_old_schema', 'mx_new_schema')
ORDER BY "Distributed Schemas";
Distributed Schemas
---------------------------------------------------------------------
mx_old_schema
mx_new_schema
mx_old_schema
(2 rows)

\c - - - :worker_1_port
Expand Down Expand Up @@ -542,7 +545,7 @@ SET client_min_messages TO ERROR;
CREATE ROLE schema_owner WITH LOGIN;
RESET client_min_messages;
SELECT run_command_on_workers($$SET citus.enable_ddl_propagation TO OFF;CREATE ROLE schema_owner WITH LOGIN;RESET citus.enable_ddl_propagation;$$);
run_command_on_workers
run_command_on_workers
---------------------------------------------------------------------
(localhost,57637,t,SET)
(localhost,57638,t,SET)
Expand All @@ -567,7 +570,7 @@ SET client_min_messages TO ERROR;
CREATE ROLE role_to_be_granted WITH LOGIN;
RESET client_min_messages;
SELECT run_command_on_workers($$SET citus.enable_ddl_propagation TO OFF;CREATE ROLE role_to_be_granted WITH LOGIN;RESET citus.enable_ddl_propagation;$$);
run_command_on_workers
run_command_on_workers
---------------------------------------------------------------------
(localhost,57637,t,SET)
(localhost,57638,t,SET)
Expand Down Expand Up @@ -616,3 +619,6 @@ NOTICE: drop cascades to table new_schema.t1
DROP SCHEMA mx_old_schema CASCADE;
DROP SCHEMA mx_new_schema CASCADE;
NOTICE: drop cascades to table mx_new_schema.table_set_schema
DROP SCHEMA localschema;
DROP ROLE schema_owner;
DROP ROLE role_to_be_granted;
12 changes: 9 additions & 3 deletions src/test/regress/sql/multi_mx_schema_support.sql
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ END;
-- test inserting to table in different schema
SET search_path TO public;

DELETE from citus_mx_test_schema.nation_hash where n_nationkey = 100; -- allow rerunning this file
INSERT INTO citus_mx_test_schema.nation_hash(n_nationkey, n_name, n_regionkey) VALUES (100, 'TURKEY', 3);

-- verify insertion
Expand All @@ -46,6 +47,7 @@ SELECT * FROM citus_mx_test_schema.nation_hash WHERE n_nationkey = 100;
-- test with search_path is set
SET search_path TO citus_mx_test_schema;

DELETE from nation_hash where n_nationkey = 101; -- allow rerunning this file
INSERT INTO nation_hash(n_nationkey, n_name, n_regionkey) VALUES (101, 'GERMANY', 3);

-- verify insertion
Expand Down Expand Up @@ -307,7 +309,7 @@ CREATE TABLE mx_old_schema.table_set_schema (id int);
SELECT create_distributed_table('mx_old_schema.table_set_schema', 'id');
CREATE SCHEMA mx_new_schema;

SELECT objid::oid::regnamespace as "Distributed Schemas"
SELECT objid::oid::regnamespace::text as "Distributed Schemas"
FROM pg_catalog.pg_dist_object
WHERE objid::oid::regnamespace IN ('mx_old_schema', 'mx_new_schema')
ORDER BY "Distributed Schemas";
Expand All @@ -324,9 +326,10 @@ ALTER SCHEMA mx_old_schema RENAME TO temp_mx_old_schema;

ALTER TABLE mx_old_schema.table_set_schema SET SCHEMA mx_new_schema;

SELECT objid::oid::regnamespace as "Distributed Schemas"
SELECT objid::oid::regnamespace::text as "Distributed Schemas"
FROM pg_catalog.pg_dist_object
WHERE objid::oid::regnamespace IN ('mx_old_schema', 'mx_new_schema');
WHERE objid::oid::regnamespace IN ('mx_old_schema', 'mx_new_schema')
ORDER BY "Distributed Schemas";
\c - - - :worker_1_port
SELECT table_schema AS "Table's Schema" FROM information_schema.tables WHERE table_name='table_set_schema';
SELECT table_schema AS "Shards' Schema"
Expand Down Expand Up @@ -392,3 +395,6 @@ SELECT COUNT(*)=0 FROM pg_dist_partition WHERE logicalrelid='new_schema.t1'::reg
DROP SCHEMA old_schema, new_schema CASCADE;
DROP SCHEMA mx_old_schema CASCADE;
DROP SCHEMA mx_new_schema CASCADE;
DROP SCHEMA localschema;
DROP ROLE schema_owner;
DROP ROLE role_to_be_granted;