Reproduce bug via test suite

(cherry picked from commit ef2ca03f24)
pull/5568/head
Onur Tirtir 2021-11-10 15:15:54 +03:00
parent de39835da2
commit 88f2b8a60d
4 changed files with 58 additions and 2 deletions

View File

@ -2,7 +2,10 @@
test: multi_test_helpers multi_test_helpers_superuser
test: multi_test_catalog_views
test: upgrade_basic_before
test: upgrade_columnar_before
test: upgrade_ref2ref_before
test: upgrade_type_before
test: upgrade_distributed_function_before upgrade_rebalance_strategy_before
# upgrade_columnar_before renames public schema to citus_schema, so let's
# run this test as the last one.
test: upgrade_columnar_before

View File

@ -5,6 +5,33 @@ SELECT substring(:'server_version', '\d+')::int > 11 AS server_version_above_ele
\else
\q
\endif
-- Test if relying on topological sort of the objects, not their names, works
-- fine when re-creating objects during pg_upgrade.
ALTER SCHEMA public RENAME TO citus_schema;
SET search_path TO citus_schema;
-- As mentioned in https://github.com/citusdata/citus/issues/5447, it
-- is essential to already have public schema to be able to use
-- citus_prepare_pg_upgrade. Until fixing that bug, let's create public
-- schema here on all nodes.
CREATE SCHEMA IF NOT EXISTS public;
-- Do "SELECT 1" to hide port numbers
SELECT 1 FROM run_command_on_workers($$CREATE SCHEMA IF NOT EXISTS public$$);
?column?
---------------------------------------------------------------------
1
1
(2 rows)
-- create a columnar table within citus_schema
CREATE TABLE new_columnar_table (
col_1 character varying(100),
col_2 date,
col_3 character varying(100),
col_4 date
) USING columnar;
INSERT INTO new_columnar_table
SELECT ('1', '1999-01-01'::timestamp, '1', '1999-01-01'::timestamp)
FROM generate_series(1, 1000);
CREATE SCHEMA upgrade_columnar;
SET search_path TO upgrade_columnar, public;
CREATE TYPE compfoo AS (f1 int, f2 text);

View File

@ -253,11 +253,11 @@ ORDER BY 1;
type noderole
view citus_dist_stat_activity
view citus_lock_waits
view citus_schema.citus_tables
view citus_shard_indexes_on_worker
view citus_shards
view citus_shards_on_worker
view citus_stat_statements
view citus_tables
view citus_worker_stat_activity
view pg_dist_shard_placement
view time_partitions

View File

@ -6,6 +6,32 @@ SELECT substring(:'server_version', '\d+')::int > 11 AS server_version_above_ele
\q
\endif
-- Test if relying on topological sort of the objects, not their names, works
-- fine when re-creating objects during pg_upgrade.
ALTER SCHEMA public RENAME TO citus_schema;
SET search_path TO citus_schema;
-- As mentioned in https://github.com/citusdata/citus/issues/5447, it
-- is essential to already have public schema to be able to use
-- citus_prepare_pg_upgrade. Until fixing that bug, let's create public
-- schema here on all nodes.
CREATE SCHEMA IF NOT EXISTS public;
-- Do "SELECT 1" to hide port numbers
SELECT 1 FROM run_command_on_workers($$CREATE SCHEMA IF NOT EXISTS public$$);
-- create a columnar table within citus_schema
CREATE TABLE new_columnar_table (
col_1 character varying(100),
col_2 date,
col_3 character varying(100),
col_4 date
) USING columnar;
INSERT INTO new_columnar_table
SELECT ('1', '1999-01-01'::timestamp, '1', '1999-01-01'::timestamp)
FROM generate_series(1, 1000);
CREATE SCHEMA upgrade_columnar;
SET search_path TO upgrade_columnar, public;