Fix flaky multi_mx_schema_support test (#6813)

This happened sometimes:
```diff
 SELECT objid::oid::regnamespace as "Distributed Schemas"
     FROM pg_catalog.pg_dist_object
     WHERE objid::oid::regnamespace IN ('mx_old_schema', 'mx_new_schema');
  Distributed Schemas
 ---------------------
- mx_old_schema
  mx_new_schema
+ mx_old_schema
 (2 rows)
```

Source:
https://app.circleci.com/pipelines/github/citusdata/citus/31706/workflows/edc84a6a-dfef-42b3-ab5c-54daa64c2154/jobs/1065463

In passing make multi_mx_schema_support runnable with run_test.py
pull/6593/head
Jelte Fennema 2023-03-31 12:36:53 +02:00 committed by GitHub
parent 7b60cdd13b
commit 085b59f586
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 10 deletions

View File

@ -143,6 +143,7 @@ if __name__ == "__main__":
"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"),
}

View File

@ -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;
@ -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;
@ -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
@ -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
@ -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;

View File

@ -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
@ -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
@ -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";
@ -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"
@ -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;