Do clean-up before upgrade_columnar_before to make it runnable multiple times

So that flaky test detector can run upgrade_columnar_before.sql multiple
times.
pull/6628/head
Onur Tirtir 2023-01-16 18:11:00 +03:00
parent 994f67185f
commit 2b4be535de
2 changed files with 46 additions and 0 deletions

View File

@ -1,5 +1,27 @@
-- Test if relying on topological sort of the objects, not their names, works -- Test if relying on topological sort of the objects, not their names, works
-- fine when re-creating objects during pg_upgrade. -- fine when re-creating objects during pg_upgrade.
DO
$$
BEGIN
IF EXISTS (SELECT * FROM pg_namespace WHERE nspname = 'upgrade_columnar')
THEN
-- Drop the the table leftover from the earlier run of
-- upgrade_columnar_before.sql. Similarly, drop the fake public schema
-- created before and rename the original one (renamed to citus_schema)
-- back to public.
--
-- This can only happen if upgrade_columnar_before.sql is run multiple
-- times for flaky test detection.
DROP TABLE citus_schema.new_columnar_table;
DROP SCHEMA public CASCADE;
ALTER SCHEMA citus_schema RENAME TO public;
SET LOCAL client_min_messages TO WARNING;
DROP SCHEMA upgrade_columnar CASCADE;
END IF;
END
$$
LANGUAGE plpgsql;
ALTER SCHEMA public RENAME TO citus_schema; ALTER SCHEMA public RENAME TO citus_schema;
SET search_path TO citus_schema; SET search_path TO citus_schema;
-- As mentioned in https://github.com/citusdata/citus/issues/5447, it -- As mentioned in https://github.com/citusdata/citus/issues/5447, it

View File

@ -1,5 +1,29 @@
-- Test if relying on topological sort of the objects, not their names, works -- Test if relying on topological sort of the objects, not their names, works
-- fine when re-creating objects during pg_upgrade. -- fine when re-creating objects during pg_upgrade.
DO
$$
BEGIN
IF EXISTS (SELECT * FROM pg_namespace WHERE nspname = 'upgrade_columnar')
THEN
-- Drop the the table leftover from the earlier run of
-- upgrade_columnar_before.sql. Similarly, drop the fake public schema
-- created before and rename the original one (renamed to citus_schema)
-- back to public.
--
-- This can only happen if upgrade_columnar_before.sql is run multiple
-- times for flaky test detection.
DROP TABLE citus_schema.new_columnar_table;
DROP SCHEMA public CASCADE;
ALTER SCHEMA citus_schema RENAME TO public;
SET LOCAL client_min_messages TO WARNING;
DROP SCHEMA upgrade_columnar CASCADE;
END IF;
END
$$
LANGUAGE plpgsql;
ALTER SCHEMA public RENAME TO citus_schema; ALTER SCHEMA public RENAME TO citus_schema;
SET search_path TO citus_schema; SET search_path TO citus_schema;