Skip to content

Commit

Permalink
Fix flaky multi_schema_support (#6991)
Browse files Browse the repository at this point in the history
Dropping a leftover table, delete some unnecessary command, add some
ORDER BY to avoid flakiness in `multi_schema_support`
  • Loading branch information
agedemenli committed Jun 9, 2023
1 parent 50e6c50 commit 2f13b37
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
10 changes: 5 additions & 5 deletions src/test/regress/expected/multi_schema_support.out
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ SELECT create_distributed_table('old_schema.table_set_schema', 'id');
CREATE SCHEMA new_schema;
SELECT objid::oid::regnamespace as "Distributed Schemas"
FROM pg_catalog.pg_dist_object
WHERE objid::oid::regnamespace IN ('old_schema', 'new_schema');
WHERE objid::oid::regnamespace IN ('old_schema', 'new_schema') ORDER BY objid::oid::regnamespace;
Distributed Schemas
---------------------------------------------------------------------
old_schema
Expand All @@ -890,7 +890,7 @@ SELECT table_schema AS "Shards' Schema"
ALTER TABLE old_schema.table_set_schema SET SCHEMA new_schema;
SELECT objid::oid::regnamespace as "Distributed Schemas"
FROM pg_catalog.pg_dist_object
WHERE objid::oid::regnamespace IN ('old_schema', 'new_schema');
WHERE objid::oid::regnamespace IN ('old_schema', 'new_schema') ORDER BY objid::oid::regnamespace;
Distributed Schemas
---------------------------------------------------------------------
old_schema
Expand Down Expand Up @@ -994,7 +994,7 @@ SELECT create_distributed_table('table_set_schema', 'id');
CREATE SCHEMA new_schema;
SELECT objid::oid::regnamespace as "Distributed Schemas"
FROM pg_catalog.pg_dist_object
WHERE objid::oid::regnamespace IN ('old_schema', 'new_schema');
WHERE objid::oid::regnamespace IN ('old_schema', 'new_schema') ORDER BY objid::oid::regnamespace;
Distributed Schemas
---------------------------------------------------------------------
old_schema
Expand All @@ -1018,7 +1018,7 @@ SET search_path TO old_schema;
ALTER TABLE table_set_schema SET SCHEMA new_schema;
SELECT objid::oid::regnamespace as "Distributed Schemas"
FROM pg_catalog.pg_dist_object
WHERE objid::oid::regnamespace IN ('old_schema', 'new_schema');
WHERE objid::oid::regnamespace IN ('old_schema', 'new_schema') ORDER BY objid::oid::regnamespace;
Distributed Schemas
---------------------------------------------------------------------
old_schema
Expand Down Expand Up @@ -1160,7 +1160,6 @@ NOTICE: schema "schema_with_user" does not exist, skipping
CONTEXT: SQL statement "SELECT citus_drop_all_shards(v_obj.objid, v_obj.schema_name, v_obj.object_name, drop_shards_metadata_only := false)"
PL/pgSQL function citus_drop_trigger() line XX at PERFORM
DROP USER "test-user";
DROP FUNCTION run_command_on_coordinator_and_workers(p_sql text);
-- test run_command_on_* UDFs with schema
CREATE SCHEMA run_test_schema;
CREATE TABLE run_test_schema.test_table(id int);
Expand Down Expand Up @@ -1399,3 +1398,4 @@ SELECT pg_identify_object_as_address(classid, objid, objsubid) FROM pg_catalog.p
---------------------------------------------------------------------
(0 rows)

DROP TABLE public.nation_local CASCADE;
11 changes: 5 additions & 6 deletions src/test/regress/sql/multi_schema_support.sql
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ CREATE SCHEMA new_schema;

SELECT objid::oid::regnamespace as "Distributed Schemas"
FROM pg_catalog.pg_dist_object
WHERE objid::oid::regnamespace IN ('old_schema', 'new_schema');
WHERE objid::oid::regnamespace IN ('old_schema', 'new_schema') ORDER BY objid::oid::regnamespace;
\c - - - :worker_1_port
SELECT table_schema AS "Shards' Schema"
FROM information_schema.tables
Expand All @@ -684,7 +684,7 @@ ALTER TABLE old_schema.table_set_schema SET SCHEMA new_schema;

SELECT objid::oid::regnamespace as "Distributed Schemas"
FROM pg_catalog.pg_dist_object
WHERE objid::oid::regnamespace IN ('old_schema', 'new_schema');
WHERE objid::oid::regnamespace IN ('old_schema', 'new_schema') ORDER BY objid::oid::regnamespace;
\c - - - :worker_1_port
SELECT table_schema AS "Shards' Schema"
FROM information_schema.tables
Expand Down Expand Up @@ -742,7 +742,7 @@ CREATE SCHEMA new_schema;

SELECT objid::oid::regnamespace as "Distributed Schemas"
FROM pg_catalog.pg_dist_object
WHERE objid::oid::regnamespace IN ('old_schema', 'new_schema');
WHERE objid::oid::regnamespace IN ('old_schema', 'new_schema') ORDER BY objid::oid::regnamespace;
\c - - - :worker_1_port
SELECT table_schema AS "Shards' Schema", COUNT(*) AS "Counts"
FROM information_schema.tables
Expand All @@ -756,7 +756,7 @@ ALTER TABLE table_set_schema SET SCHEMA new_schema;

SELECT objid::oid::regnamespace as "Distributed Schemas"
FROM pg_catalog.pg_dist_object
WHERE objid::oid::regnamespace IN ('old_schema', 'new_schema');
WHERE objid::oid::regnamespace IN ('old_schema', 'new_schema') ORDER BY objid::oid::regnamespace;
\c - - - :worker_1_port
SELECT table_schema AS "Shards' Schema", COUNT(*) AS "Counts"
FROM information_schema.tables
Expand Down Expand Up @@ -844,8 +844,6 @@ SET citus.next_shard_id TO 1197000;
DROP OWNED BY "test-user" CASCADE;
DROP USER "test-user";

DROP FUNCTION run_command_on_coordinator_and_workers(p_sql text);

-- test run_command_on_* UDFs with schema
CREATE SCHEMA run_test_schema;
CREATE TABLE run_test_schema.test_table(id int);
Expand Down Expand Up @@ -991,3 +989,4 @@ DROP SCHEMA run_test_schema, test_schema_support_join_1, test_schema_support_joi
-- verify that the dropped schema is removed from worker's pg_dist_object
SELECT pg_identify_object_as_address(classid, objid, objsubid) FROM pg_catalog.pg_dist_object
WHERE classid=2615 and objid IN (select oid from pg_namespace where nspname='run_test_schema');
DROP TABLE public.nation_local CASCADE;

0 comments on commit 2f13b37

Please sign in to comment.