mirror of https://github.com/citusdata/citus.git
Remove public schema dependency for 10.0 upgrades
This commit contains a subset of the changes that should be cherry
picked to 10.0 releases.
(cherry picked from commit 8e9cc229ff
)
pull/5152/head
parent
fefaed37e7
commit
60424534ef
|
@ -1,5 +1,16 @@
|
||||||
|
-- citus--10.0-3--10.0-4
|
||||||
|
|
||||||
|
-- This migration file aims to fix 2 issues with upgrades on clusters
|
||||||
|
|
||||||
|
-- 1. a bug in public schema dependency for citus_tables view.
|
||||||
--
|
--
|
||||||
-- 10.0-3--10.0-4 was added later as a patch to fix a bug in our PG upgrade functions
|
-- Users who do not have public schema in their clusters were unable to upgrade
|
||||||
|
-- to Citus 10.x due to the citus_tables view that used to be created in public
|
||||||
|
-- schema
|
||||||
|
|
||||||
|
#include "udfs/citus_tables/10.0-4.sql"
|
||||||
|
|
||||||
|
-- 2. a bug in our PG upgrade functions
|
||||||
--
|
--
|
||||||
-- Users who took the 9.5-2--10.0-1 upgrade path already have the fix, but users
|
-- Users who took the 9.5-2--10.0-1 upgrade path already have the fix, but users
|
||||||
-- who took the 9.5-1--10.0-1 upgrade path do not. Hence, we repeat the CREATE OR
|
-- who took the 9.5-1--10.0-1 upgrade path do not. Hence, we repeat the CREATE OR
|
||||||
|
|
|
@ -1,10 +1,16 @@
|
||||||
-- citus--9.5-1--10.0-1
|
-- citus--9.5-1--10.0-4
|
||||||
|
|
||||||
|
-- This migration file aims to fix the issues with upgrades on clusters without public schema.
|
||||||
|
|
||||||
|
-- This file is created by the following command, and some more changes in a separate commit
|
||||||
|
-- cat citus--9.5-1--10.0-1.sql citus--10.0-1--10.0-2.sql citus--10.0-2--10.0-3.sql > citus--9.5-1--10.0-4.sql
|
||||||
|
|
||||||
|
-- copy of citus--9.5-1--10.0-1
|
||||||
|
|
||||||
DROP FUNCTION pg_catalog.upgrade_to_reference_table(regclass);
|
DROP FUNCTION pg_catalog.upgrade_to_reference_table(regclass);
|
||||||
DROP FUNCTION IF EXISTS pg_catalog.citus_total_relation_size(regclass);
|
DROP FUNCTION IF EXISTS pg_catalog.citus_total_relation_size(regclass);
|
||||||
|
|
||||||
#include "udfs/citus_total_relation_size/10.0-1.sql"
|
#include "udfs/citus_total_relation_size/10.0-1.sql"
|
||||||
#include "udfs/citus_tables/10.0-1.sql"
|
|
||||||
#include "udfs/citus_finish_pg_upgrade/10.0-1.sql"
|
#include "udfs/citus_finish_pg_upgrade/10.0-1.sql"
|
||||||
#include "udfs/alter_distributed_table/10.0-1.sql"
|
#include "udfs/alter_distributed_table/10.0-1.sql"
|
||||||
#include "udfs/alter_table_set_access_method/10.0-1.sql"
|
#include "udfs/alter_table_set_access_method/10.0-1.sql"
|
||||||
|
@ -164,4 +170,48 @@ SELECT * FROM pg_catalog.citus_worker_stat_activity();
|
||||||
ALTER VIEW citus.citus_worker_stat_activity SET SCHEMA pg_catalog;
|
ALTER VIEW citus.citus_worker_stat_activity SET SCHEMA pg_catalog;
|
||||||
GRANT SELECT ON pg_catalog.citus_worker_stat_activity TO PUBLIC;
|
GRANT SELECT ON pg_catalog.citus_worker_stat_activity TO PUBLIC;
|
||||||
|
|
||||||
|
-- copy of citus--10.0-1--10.0-2
|
||||||
|
|
||||||
|
#include "../../columnar/sql/columnar--10.0-1--10.0-2.sql"
|
||||||
|
|
||||||
|
-- copy of citus--10.0-2--10.0-3
|
||||||
|
|
||||||
|
#include "udfs/citus_update_table_statistics/10.0-3.sql"
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION master_update_table_statistics(relation regclass)
|
||||||
|
RETURNS VOID
|
||||||
|
LANGUAGE C STRICT
|
||||||
|
AS 'MODULE_PATHNAME', $$citus_update_table_statistics$$;
|
||||||
|
COMMENT ON FUNCTION pg_catalog.master_update_table_statistics(regclass)
|
||||||
|
IS 'updates shard statistics of the given table';
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION pg_catalog.citus_get_active_worker_nodes(OUT node_name text, OUT node_port bigint)
|
||||||
|
RETURNS SETOF record
|
||||||
|
LANGUAGE C STRICT ROWS 100
|
||||||
|
AS 'MODULE_PATHNAME', $$citus_get_active_worker_nodes$$;
|
||||||
|
COMMENT ON FUNCTION pg_catalog.citus_get_active_worker_nodes()
|
||||||
|
IS 'fetch set of active worker nodes';
|
||||||
|
|
||||||
|
-- copy of citus--10.0-3--10.0-4
|
||||||
|
|
||||||
|
-- This migration file aims to fix 2 issues with upgrades on clusters
|
||||||
|
|
||||||
|
-- 1. a bug in public schema dependency for citus_tables view.
|
||||||
|
--
|
||||||
|
-- Users who do not have public schema in their clusters were unable to upgrade
|
||||||
|
-- to Citus 10.x due to the citus_tables view that used to be created in public
|
||||||
|
-- schema
|
||||||
|
|
||||||
|
#include "udfs/citus_tables/10.0-4.sql"
|
||||||
|
|
||||||
|
-- 2. a bug in our PG upgrade functions
|
||||||
|
--
|
||||||
|
-- Users who took the 9.5-2--10.0-1 upgrade path already have the fix, but users
|
||||||
|
-- who took the 9.5-1--10.0-1 upgrade path do not. Hence, we repeat the CREATE OR
|
||||||
|
-- REPLACE from the 9.5-2 definition for citus_prepare_pg_upgrade.
|
||||||
|
|
||||||
|
#include "udfs/citus_prepare_pg_upgrade/9.5-2.sql"
|
||||||
|
#include "udfs/citus_finish_pg_upgrade/10.0-4.sql"
|
||||||
|
|
||||||
|
|
||||||
RESET search_path;
|
RESET search_path;
|
|
@ -1,4 +0,0 @@
|
||||||
/* citus--10.0-2--10.0-1.sql */
|
|
||||||
#include "../../../columnar/sql/downgrades/columnar--10.0-2--10.0-1.sql"
|
|
||||||
|
|
||||||
REVOKE SELECT ON public.citus_tables FROM public;
|
|
|
@ -1,26 +0,0 @@
|
||||||
-- citus--10.0-3--10.0-2
|
|
||||||
-- this is a downgrade path that will revert the changes made in citus--10.0-2--10.0-3.sql
|
|
||||||
|
|
||||||
DROP FUNCTION pg_catalog.citus_update_table_statistics(regclass);
|
|
||||||
|
|
||||||
#include "../udfs/citus_update_table_statistics/10.0-1.sql"
|
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION master_update_table_statistics(relation regclass)
|
|
||||||
RETURNS VOID AS $$
|
|
||||||
DECLARE
|
|
||||||
colocated_tables regclass[];
|
|
||||||
BEGIN
|
|
||||||
SELECT get_colocated_table_array(relation) INTO colocated_tables;
|
|
||||||
|
|
||||||
PERFORM
|
|
||||||
master_update_shard_statistics(shardid)
|
|
||||||
FROM
|
|
||||||
pg_dist_shard
|
|
||||||
WHERE
|
|
||||||
logicalrelid = ANY (colocated_tables);
|
|
||||||
END;
|
|
||||||
$$ LANGUAGE 'plpgsql';
|
|
||||||
COMMENT ON FUNCTION master_update_table_statistics(regclass)
|
|
||||||
IS 'updates shard statistics of the given table and its colocated tables';
|
|
||||||
|
|
||||||
DROP FUNCTION pg_catalog.citus_get_active_worker_nodes(OUT text, OUT bigint);
|
|
|
@ -1,9 +0,0 @@
|
||||||
--
|
|
||||||
-- 10.0-3--10.0-4 was added later as a patch to fix a bug in our PG upgrade functions
|
|
||||||
--
|
|
||||||
-- The upgrade fixes a bug in citus_(prepare|finish)_pg_upgrade. Given the old versions of
|
|
||||||
-- these functions contain a bug it is better to _not_ restore the old version and keep
|
|
||||||
-- the patched version of the function.
|
|
||||||
--
|
|
||||||
-- This is inline with the downgrade scripts for earlier versions of this patch
|
|
||||||
--
|
|
|
@ -1,4 +1,51 @@
|
||||||
-- citus--10.0-1--9.5-1
|
-- citus--10.0-4--9.5-1
|
||||||
|
|
||||||
|
-- This migration file aims to fix the issues with upgrades on clusters without public schema.
|
||||||
|
|
||||||
|
-- This file is created by the following command, and some more changes in a separate commit
|
||||||
|
-- cat citus--10.0-3--10.0-2.sql citus--10.0-2--10.0-1.sql citus--10.0-1--9.5-1.sql > citus--10.0-4--9.5-1.sql
|
||||||
|
|
||||||
|
-- copy of citus--10.0-4--10.0-3
|
||||||
|
--
|
||||||
|
-- 10.0-3--10.0-4 was added later as a patch to fix a bug in our PG upgrade functions
|
||||||
|
--
|
||||||
|
-- The upgrade fixes a bug in citus_(prepare|finish)_pg_upgrade. Given the old versions of
|
||||||
|
-- these functions contain a bug it is better to _not_ restore the old version and keep
|
||||||
|
-- the patched version of the function.
|
||||||
|
--
|
||||||
|
-- This is inline with the downgrade scripts for earlier versions of this patch
|
||||||
|
--
|
||||||
|
|
||||||
|
-- copy of citus--10.0-3--10.0-2
|
||||||
|
-- this is a downgrade path that will revert the changes made in citus--10.0-2--10.0-3.sql
|
||||||
|
|
||||||
|
DROP FUNCTION pg_catalog.citus_update_table_statistics(regclass);
|
||||||
|
|
||||||
|
#include "../udfs/citus_update_table_statistics/10.0-1.sql"
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION master_update_table_statistics(relation regclass)
|
||||||
|
RETURNS VOID AS $$
|
||||||
|
DECLARE
|
||||||
|
colocated_tables regclass[];
|
||||||
|
BEGIN
|
||||||
|
SELECT get_colocated_table_array(relation) INTO colocated_tables;
|
||||||
|
|
||||||
|
PERFORM
|
||||||
|
master_update_shard_statistics(shardid)
|
||||||
|
FROM
|
||||||
|
pg_dist_shard
|
||||||
|
WHERE
|
||||||
|
logicalrelid = ANY (colocated_tables);
|
||||||
|
END;
|
||||||
|
$$ LANGUAGE 'plpgsql';
|
||||||
|
COMMENT ON FUNCTION master_update_table_statistics(regclass)
|
||||||
|
IS 'updates shard statistics of the given table and its colocated tables';
|
||||||
|
|
||||||
|
DROP FUNCTION pg_catalog.citus_get_active_worker_nodes(OUT text, OUT bigint);
|
||||||
|
/* copy of citus--10.0-2--10.0-1.sql */
|
||||||
|
#include "../../../columnar/sql/downgrades/columnar--10.0-2--10.0-1.sql"
|
||||||
|
|
||||||
|
-- copy of citus--10.0-1--9.5-1
|
||||||
|
|
||||||
-- In Citus 10.0, we added another internal udf (notify_constraint_dropped)
|
-- In Citus 10.0, we added another internal udf (notify_constraint_dropped)
|
||||||
-- to be called by citus_drop_trigger. Since this script is executed when
|
-- to be called by citus_drop_trigger. Since this script is executed when
|
||||||
|
@ -18,7 +65,8 @@ DROP FUNCTION pg_catalog.notify_constraint_dropped();
|
||||||
|
|
||||||
#include "../../../columnar/sql/downgrades/columnar--10.0-1--9.5-1.sql"
|
#include "../../../columnar/sql/downgrades/columnar--10.0-1--9.5-1.sql"
|
||||||
|
|
||||||
DROP VIEW public.citus_tables;
|
DROP VIEW IF EXISTS pg_catalog.citus_tables;
|
||||||
|
DROP VIEW IF EXISTS public.citus_tables;
|
||||||
DROP FUNCTION pg_catalog.alter_distributed_table(regclass, text, int, text, boolean);
|
DROP FUNCTION pg_catalog.alter_distributed_table(regclass, text, int, text, boolean);
|
||||||
DROP FUNCTION pg_catalog.alter_table_set_access_method(regclass, text);
|
DROP FUNCTION pg_catalog.alter_table_set_access_method(regclass, text);
|
||||||
DROP FUNCTION pg_catalog.citus_total_relation_size(regclass,boolean);
|
DROP FUNCTION pg_catalog.citus_total_relation_size(regclass,boolean);
|
|
@ -0,0 +1,38 @@
|
||||||
|
DO $$
|
||||||
|
declare
|
||||||
|
citus_tables_create_query text;
|
||||||
|
BEGIN
|
||||||
|
citus_tables_create_query=$CTCQ$
|
||||||
|
CREATE OR REPLACE VIEW %I.citus_tables AS
|
||||||
|
SELECT
|
||||||
|
logicalrelid AS table_name,
|
||||||
|
CASE WHEN partkey IS NOT NULL THEN 'distributed' ELSE 'reference' END AS citus_table_type,
|
||||||
|
coalesce(column_to_column_name(logicalrelid, partkey), '<none>') AS distribution_column,
|
||||||
|
colocationid AS colocation_id,
|
||||||
|
pg_size_pretty(citus_total_relation_size(logicalrelid, fail_on_error := false)) AS table_size,
|
||||||
|
(select count(*) from pg_dist_shard where logicalrelid = p.logicalrelid) AS shard_count,
|
||||||
|
pg_get_userbyid(relowner) AS table_owner,
|
||||||
|
amname AS access_method
|
||||||
|
FROM
|
||||||
|
pg_dist_partition p
|
||||||
|
JOIN
|
||||||
|
pg_class c ON (p.logicalrelid = c.oid)
|
||||||
|
LEFT JOIN
|
||||||
|
pg_am a ON (a.oid = c.relam)
|
||||||
|
WHERE
|
||||||
|
partkey IS NOT NULL OR repmodel = 't'
|
||||||
|
ORDER BY
|
||||||
|
logicalrelid::text;
|
||||||
|
$CTCQ$;
|
||||||
|
|
||||||
|
IF EXISTS (SELECT 1 FROM pg_namespace WHERE nspname = 'public') THEN
|
||||||
|
EXECUTE format(citus_tables_create_query, 'public');
|
||||||
|
GRANT SELECT ON public.citus_tables TO public;
|
||||||
|
ELSE
|
||||||
|
EXECUTE format(citus_tables_create_query, 'citus');
|
||||||
|
ALTER VIEW citus.citus_tables SET SCHEMA pg_catalog;
|
||||||
|
GRANT SELECT ON pg_catalog.citus_tables TO public;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
END;
|
||||||
|
$$;
|
|
@ -1,4 +1,9 @@
|
||||||
CREATE VIEW public.citus_tables AS
|
DO $$
|
||||||
|
declare
|
||||||
|
citus_tables_create_query text;
|
||||||
|
BEGIN
|
||||||
|
citus_tables_create_query=$CTCQ$
|
||||||
|
CREATE OR REPLACE VIEW %I.citus_tables AS
|
||||||
SELECT
|
SELECT
|
||||||
logicalrelid AS table_name,
|
logicalrelid AS table_name,
|
||||||
CASE WHEN partkey IS NOT NULL THEN 'distributed' ELSE 'reference' END AS citus_table_type,
|
CASE WHEN partkey IS NOT NULL THEN 'distributed' ELSE 'reference' END AS citus_table_type,
|
||||||
|
@ -18,3 +23,16 @@ WHERE
|
||||||
partkey IS NOT NULL OR repmodel = 't'
|
partkey IS NOT NULL OR repmodel = 't'
|
||||||
ORDER BY
|
ORDER BY
|
||||||
logicalrelid::text;
|
logicalrelid::text;
|
||||||
|
$CTCQ$;
|
||||||
|
|
||||||
|
IF EXISTS (SELECT 1 FROM pg_namespace WHERE nspname = 'public') THEN
|
||||||
|
EXECUTE format(citus_tables_create_query, 'public');
|
||||||
|
GRANT SELECT ON public.citus_tables TO public;
|
||||||
|
ELSE
|
||||||
|
EXECUTE format(citus_tables_create_query, 'citus');
|
||||||
|
ALTER VIEW citus.citus_tables SET SCHEMA pg_catalog;
|
||||||
|
GRANT SELECT ON pg_catalog.citus_tables TO public;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
END;
|
||||||
|
$$;
|
||||||
|
|
|
@ -16,6 +16,7 @@ SELECT substring(:'server_version', '\d+')::int > 11 AS version_above_eleven;
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SET citus.next_shard_id TO 580000;
|
SET citus.next_shard_id TO 580000;
|
||||||
|
CREATE SCHEMA multi_extension;
|
||||||
SELECT $definition$
|
SELECT $definition$
|
||||||
CREATE OR REPLACE FUNCTION test.maintenance_worker()
|
CREATE OR REPLACE FUNCTION test.maintenance_worker()
|
||||||
RETURNS pg_stat_activity
|
RETURNS pg_stat_activity
|
||||||
|
@ -42,13 +43,14 @@ END;
|
||||||
$$;
|
$$;
|
||||||
$definition$ create_function_test_maintenance_worker
|
$definition$ create_function_test_maintenance_worker
|
||||||
\gset
|
\gset
|
||||||
CREATE TABLE prev_objects(description text);
|
CREATE TABLE multi_extension.prev_objects(description text);
|
||||||
CREATE TABLE extension_diff(previous_object text COLLATE "C",
|
CREATE TABLE multi_extension.extension_diff(previous_object text COLLATE "C",
|
||||||
current_object text COLLATE "C");
|
current_object text COLLATE "C");
|
||||||
CREATE FUNCTION print_extension_changes()
|
CREATE FUNCTION multi_extension.print_extension_changes()
|
||||||
RETURNS TABLE(previous_object text, current_object text)
|
RETURNS TABLE(previous_object text, current_object text)
|
||||||
AS $func$
|
AS $func$
|
||||||
BEGIN
|
BEGIN
|
||||||
|
SET LOCAL search_path TO multi_extension;
|
||||||
TRUNCATE TABLE extension_diff;
|
TRUNCATE TABLE extension_diff;
|
||||||
|
|
||||||
CREATE TABLE current_objects AS
|
CREATE TABLE current_objects AS
|
||||||
|
@ -130,7 +132,7 @@ ALTER EXTENSION citus UPDATE TO '9.1-1';
|
||||||
ALTER EXTENSION citus UPDATE TO '9.2-1';
|
ALTER EXTENSION citus UPDATE TO '9.2-1';
|
||||||
ALTER EXTENSION citus UPDATE TO '9.2-2';
|
ALTER EXTENSION citus UPDATE TO '9.2-2';
|
||||||
-- Snapshot of state at 9.2-2
|
-- Snapshot of state at 9.2-2
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
previous_object | current_object
|
previous_object | current_object
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
| event trigger citus_cascade_to_partition
|
| event trigger citus_cascade_to_partition
|
||||||
|
@ -327,7 +329,7 @@ SELECT * FROM print_extension_changes();
|
||||||
ALTER EXTENSION citus UPDATE TO '9.2-4';
|
ALTER EXTENSION citus UPDATE TO '9.2-4';
|
||||||
ALTER EXTENSION citus UPDATE TO '9.2-2';
|
ALTER EXTENSION citus UPDATE TO '9.2-2';
|
||||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
previous_object | current_object
|
previous_object | current_object
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
(0 rows)
|
(0 rows)
|
||||||
|
@ -342,7 +344,7 @@ ALTER EXTENSION citus UPDATE TO '9.3-1';
|
||||||
ERROR: extension "citus" has no update path from version "9.2-2" to version "9.3-1"
|
ERROR: extension "citus" has no update path from version "9.2-2" to version "9.3-1"
|
||||||
ALTER EXTENSION citus UPDATE TO '9.2-4';
|
ALTER EXTENSION citus UPDATE TO '9.2-4';
|
||||||
-- Snapshot of state at 9.2-4
|
-- Snapshot of state at 9.2-4
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
previous_object | current_object
|
previous_object | current_object
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
(0 rows)
|
(0 rows)
|
||||||
|
@ -351,14 +353,14 @@ SELECT * FROM print_extension_changes();
|
||||||
ALTER EXTENSION citus UPDATE TO '9.3-2';
|
ALTER EXTENSION citus UPDATE TO '9.3-2';
|
||||||
ALTER EXTENSION citus UPDATE TO '9.2-4';
|
ALTER EXTENSION citus UPDATE TO '9.2-4';
|
||||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
previous_object | current_object
|
previous_object | current_object
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
(0 rows)
|
(0 rows)
|
||||||
|
|
||||||
-- Snapshot of state at 9.3-2
|
-- Snapshot of state at 9.3-2
|
||||||
ALTER EXTENSION citus UPDATE TO '9.3-2';
|
ALTER EXTENSION citus UPDATE TO '9.3-2';
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
previous_object | current_object
|
previous_object | current_object
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
function citus_extradata_container(internal) void |
|
function citus_extradata_container(internal) void |
|
||||||
|
@ -374,14 +376,14 @@ SELECT * FROM print_extension_changes();
|
||||||
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
||||||
ALTER EXTENSION citus UPDATE TO '9.3-2';
|
ALTER EXTENSION citus UPDATE TO '9.3-2';
|
||||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
previous_object | current_object
|
previous_object | current_object
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
(0 rows)
|
(0 rows)
|
||||||
|
|
||||||
-- Snapshot of state at 9.4-1
|
-- Snapshot of state at 9.4-1
|
||||||
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
previous_object | current_object
|
previous_object | current_object
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
| function worker_last_saved_explain_analyze() TABLE(explain_analyze_output text, execution_duration double precision)
|
| function worker_last_saved_explain_analyze() TABLE(explain_analyze_output text, execution_duration double precision)
|
||||||
|
@ -393,20 +395,20 @@ ALTER EXTENSION citus UPDATE TO '9.4-2';
|
||||||
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
||||||
-- Should be empty result, even though the downgrade doesn't undo the upgrade, the
|
-- Should be empty result, even though the downgrade doesn't undo the upgrade, the
|
||||||
-- function signature doesn't change, which is reflected here.
|
-- function signature doesn't change, which is reflected here.
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
previous_object | current_object
|
previous_object | current_object
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
(0 rows)
|
(0 rows)
|
||||||
|
|
||||||
ALTER EXTENSION citus UPDATE TO '9.4-2';
|
ALTER EXTENSION citus UPDATE TO '9.4-2';
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
previous_object | current_object
|
previous_object | current_object
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
(0 rows)
|
(0 rows)
|
||||||
|
|
||||||
-- Snapshot of state at 9.4-1
|
-- Snapshot of state at 9.4-1
|
||||||
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
previous_object | current_object
|
previous_object | current_object
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
(0 rows)
|
(0 rows)
|
||||||
|
@ -437,14 +439,14 @@ ROLLBACK;
|
||||||
-- now we can downgrade as there is no citus local table
|
-- now we can downgrade as there is no citus local table
|
||||||
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
||||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
previous_object | current_object
|
previous_object | current_object
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
(0 rows)
|
(0 rows)
|
||||||
|
|
||||||
-- Snapshot of state at 9.5-1
|
-- Snapshot of state at 9.5-1
|
||||||
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
previous_object | current_object
|
previous_object | current_object
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
function master_drop_sequences(text[]) void |
|
function master_drop_sequences(text[]) void |
|
||||||
|
@ -464,36 +466,38 @@ ALTER EXTENSION citus UPDATE TO '9.5-2';
|
||||||
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
||||||
-- Should be empty result, even though the downgrade doesn't undo the upgrade, the
|
-- Should be empty result, even though the downgrade doesn't undo the upgrade, the
|
||||||
-- function signature doesn't change, which is reflected here.
|
-- function signature doesn't change, which is reflected here.
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
previous_object | current_object
|
previous_object | current_object
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
(0 rows)
|
(0 rows)
|
||||||
|
|
||||||
ALTER EXTENSION citus UPDATE TO '9.5-2';
|
ALTER EXTENSION citus UPDATE TO '9.5-2';
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
previous_object | current_object
|
previous_object | current_object
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
(0 rows)
|
(0 rows)
|
||||||
|
|
||||||
-- Snapshot of state at 9.5-1
|
-- Snapshot of state at 9.5-1
|
||||||
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
previous_object | current_object
|
previous_object | current_object
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
(0 rows)
|
(0 rows)
|
||||||
|
|
||||||
-- Test downgrade to 9.5-1 from 10.0-1
|
-- We removed the upgrade paths to 10.0-1, 10.0-2 and 10.0-3 due to a bug that blocked
|
||||||
ALTER EXTENSION citus UPDATE TO '10.0-1';
|
-- upgrades to 10.0, Therefore we test upgrades to 10.0-4 instead
|
||||||
|
-- Test downgrade to 9.5-1 from 10.0-4
|
||||||
|
ALTER EXTENSION citus UPDATE TO '10.0-4';
|
||||||
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
||||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
previous_object | current_object
|
previous_object | current_object
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
(0 rows)
|
(0 rows)
|
||||||
|
|
||||||
-- Snapshot of state at 10.0-1
|
-- Snapshot of state at 10.0-4
|
||||||
ALTER EXTENSION citus UPDATE TO '10.0-1';
|
ALTER EXTENSION citus UPDATE TO '10.0-4';
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
previous_object | current_object
|
previous_object | current_object
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
function citus_total_relation_size(regclass) bigint |
|
function citus_total_relation_size(regclass) bigint |
|
||||||
|
@ -534,6 +538,7 @@ SELECT * FROM print_extension_changes();
|
||||||
| function citus_dist_shard_cache_invalidate() trigger
|
| function citus_dist_shard_cache_invalidate() trigger
|
||||||
| function citus_drain_node(text,integer,citus.shard_transfer_mode,name) void
|
| function citus_drain_node(text,integer,citus.shard_transfer_mode,name) void
|
||||||
| function citus_drop_all_shards(regclass,text,text) integer
|
| function citus_drop_all_shards(regclass,text,text) integer
|
||||||
|
| function citus_get_active_worker_nodes() SETOF record
|
||||||
| function citus_internal.columnar_ensure_objects_exist() void
|
| function citus_internal.columnar_ensure_objects_exist() void
|
||||||
| function citus_move_shard_placement(bigint,text,integer,text,integer,citus.shard_transfer_mode) void
|
| function citus_move_shard_placement(bigint,text,integer,text,integer,citus.shard_transfer_mode) void
|
||||||
| function citus_remove_node(text,integer) void
|
| function citus_remove_node(text,integer) void
|
||||||
|
@ -561,72 +566,50 @@ SELECT * FROM print_extension_changes();
|
||||||
| table columnar.options
|
| table columnar.options
|
||||||
| table columnar.stripe
|
| table columnar.stripe
|
||||||
| view citus_shards
|
| view citus_shards
|
||||||
| view citus_tables
|
| view public.citus_tables
|
||||||
| view time_partitions
|
| view time_partitions
|
||||||
(67 rows)
|
(68 rows)
|
||||||
|
|
||||||
-- Test downgrade to 10.0-1 from 10.0-2
|
-- check that we depend on the existence of public schema, and we can not drop it now
|
||||||
ALTER EXTENSION citus UPDATE TO '10.0-2';
|
DROP SCHEMA public;
|
||||||
ALTER EXTENSION citus UPDATE TO '10.0-1';
|
ERROR: cannot drop schema public because other objects depend on it
|
||||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
DETAIL: extension citus depends on schema public
|
||||||
SELECT * FROM print_extension_changes();
|
HINT: Use DROP ... CASCADE to drop the dependent objects too.
|
||||||
previous_object | current_object
|
-- verify that citus_tables view is on pg_catalog if public schema is absent.
|
||||||
---------------------------------------------------------------------
|
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
||||||
(0 rows)
|
DROP SCHEMA public;
|
||||||
|
|
||||||
-- Snapshot of state at 10.0-2
|
|
||||||
ALTER EXTENSION citus UPDATE TO '10.0-2';
|
|
||||||
SELECT * FROM print_extension_changes();
|
|
||||||
previous_object | current_object
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
(0 rows)
|
|
||||||
|
|
||||||
-- Test downgrade to 10.0-2 from 10.0-3
|
|
||||||
ALTER EXTENSION citus UPDATE TO '10.0-3';
|
|
||||||
ALTER EXTENSION citus UPDATE TO '10.0-2';
|
|
||||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
|
||||||
SELECT * FROM print_extension_changes();
|
|
||||||
previous_object | current_object
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
(0 rows)
|
|
||||||
|
|
||||||
-- Snapshot of state at 10.0-3
|
|
||||||
ALTER EXTENSION citus UPDATE TO '10.0-3';
|
|
||||||
SELECT * FROM print_extension_changes();
|
|
||||||
previous_object | current_object
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
| function citus_get_active_worker_nodes() SETOF record
|
|
||||||
(1 row)
|
|
||||||
|
|
||||||
-- Test downgrade to 10.0-3 from 10.0-4
|
|
||||||
ALTER EXTENSION citus UPDATE TO '10.0-4';
|
ALTER EXTENSION citus UPDATE TO '10.0-4';
|
||||||
ALTER EXTENSION citus UPDATE TO '10.0-3';
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
-- Should be empty result, even though the downgrade doesn't undo the upgrade, the
|
|
||||||
-- function signature doesn't change, which is reflected here.
|
|
||||||
SELECT * FROM print_extension_changes();
|
|
||||||
previous_object | current_object
|
previous_object | current_object
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
(0 rows)
|
view public.citus_tables |
|
||||||
|
| view citus_tables
|
||||||
|
(2 rows)
|
||||||
|
|
||||||
-- Snapshot of state at 10.0-4
|
-- recreate public schema, and recreate citus_tables in the public schema by default
|
||||||
|
CREATE SCHEMA public;
|
||||||
|
GRANT ALL ON SCHEMA public TO public;
|
||||||
|
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
||||||
ALTER EXTENSION citus UPDATE TO '10.0-4';
|
ALTER EXTENSION citus UPDATE TO '10.0-4';
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
previous_object | current_object
|
previous_object | current_object
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
(0 rows)
|
view citus_tables |
|
||||||
|
| view public.citus_tables
|
||||||
|
(2 rows)
|
||||||
|
|
||||||
-- Test downgrade to 10.0-4 from 10.1-1
|
-- Test downgrade to 10.0-4 from 10.1-1
|
||||||
ALTER EXTENSION citus UPDATE TO '10.1-1';
|
ALTER EXTENSION citus UPDATE TO '10.1-1';
|
||||||
ALTER EXTENSION citus UPDATE TO '10.0-4';
|
ALTER EXTENSION citus UPDATE TO '10.0-4';
|
||||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
previous_object | current_object
|
previous_object | current_object
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
(0 rows)
|
(0 rows)
|
||||||
|
|
||||||
-- Snapshot of state at 10.1-1
|
-- Snapshot of state at 10.1-1
|
||||||
ALTER EXTENSION citus UPDATE TO '10.1-1';
|
ALTER EXTENSION citus UPDATE TO '10.1-1';
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
previous_object | current_object
|
previous_object | current_object
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
function citus_add_rebalance_strategy(name,regproc,regproc,regproc,real,real) void |
|
function citus_add_rebalance_strategy(name,regproc,regproc,regproc,real,real) void |
|
||||||
|
@ -646,7 +629,7 @@ SELECT * FROM print_extension_changes();
|
||||||
| function worker_partitioned_table_size(regclass) bigint
|
| function worker_partitioned_table_size(regclass) bigint
|
||||||
(15 rows)
|
(15 rows)
|
||||||
|
|
||||||
DROP TABLE prev_objects, extension_diff;
|
DROP TABLE multi_extension.prev_objects, multi_extension.extension_diff;
|
||||||
-- show running version
|
-- show running version
|
||||||
SHOW citus.version;
|
SHOW citus.version;
|
||||||
citus.version
|
citus.version
|
||||||
|
@ -989,3 +972,7 @@ SELECT count(*) FROM pg_stat_activity WHERE application_name = 'Citus Maintenanc
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
DROP TABLE version_mismatch_table;
|
DROP TABLE version_mismatch_table;
|
||||||
|
DROP SCHEMA multi_extension;
|
||||||
|
ERROR: cannot drop schema multi_extension because other objects depend on it
|
||||||
|
DETAIL: function multi_extension.print_extension_changes() depends on schema multi_extension
|
||||||
|
HINT: Use DROP ... CASCADE to drop the dependent objects too.
|
||||||
|
|
|
@ -13,6 +13,7 @@ SHOW server_version \gset
|
||||||
SELECT substring(:'server_version', '\d+')::int > 11 AS version_above_eleven;
|
SELECT substring(:'server_version', '\d+')::int > 11 AS version_above_eleven;
|
||||||
|
|
||||||
SET citus.next_shard_id TO 580000;
|
SET citus.next_shard_id TO 580000;
|
||||||
|
CREATE SCHEMA multi_extension;
|
||||||
|
|
||||||
SELECT $definition$
|
SELECT $definition$
|
||||||
CREATE OR REPLACE FUNCTION test.maintenance_worker()
|
CREATE OR REPLACE FUNCTION test.maintenance_worker()
|
||||||
|
@ -41,14 +42,15 @@ $$;
|
||||||
$definition$ create_function_test_maintenance_worker
|
$definition$ create_function_test_maintenance_worker
|
||||||
\gset
|
\gset
|
||||||
|
|
||||||
CREATE TABLE prev_objects(description text);
|
CREATE TABLE multi_extension.prev_objects(description text);
|
||||||
CREATE TABLE extension_diff(previous_object text COLLATE "C",
|
CREATE TABLE multi_extension.extension_diff(previous_object text COLLATE "C",
|
||||||
current_object text COLLATE "C");
|
current_object text COLLATE "C");
|
||||||
|
|
||||||
CREATE FUNCTION print_extension_changes()
|
CREATE FUNCTION multi_extension.print_extension_changes()
|
||||||
RETURNS TABLE(previous_object text, current_object text)
|
RETURNS TABLE(previous_object text, current_object text)
|
||||||
AS $func$
|
AS $func$
|
||||||
BEGIN
|
BEGIN
|
||||||
|
SET LOCAL search_path TO multi_extension;
|
||||||
TRUNCATE TABLE extension_diff;
|
TRUNCATE TABLE extension_diff;
|
||||||
|
|
||||||
CREATE TABLE current_objects AS
|
CREATE TABLE current_objects AS
|
||||||
|
@ -128,13 +130,13 @@ ALTER EXTENSION citus UPDATE TO '9.1-1';
|
||||||
ALTER EXTENSION citus UPDATE TO '9.2-1';
|
ALTER EXTENSION citus UPDATE TO '9.2-1';
|
||||||
ALTER EXTENSION citus UPDATE TO '9.2-2';
|
ALTER EXTENSION citus UPDATE TO '9.2-2';
|
||||||
-- Snapshot of state at 9.2-2
|
-- Snapshot of state at 9.2-2
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
|
|
||||||
-- Test downgrade to 9.2-2 from 9.2-4
|
-- Test downgrade to 9.2-2 from 9.2-4
|
||||||
ALTER EXTENSION citus UPDATE TO '9.2-4';
|
ALTER EXTENSION citus UPDATE TO '9.2-4';
|
||||||
ALTER EXTENSION citus UPDATE TO '9.2-2';
|
ALTER EXTENSION citus UPDATE TO '9.2-2';
|
||||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* As we mistakenly bumped schema version to 9.3-1 in a bad release, we support
|
* As we mistakenly bumped schema version to 9.3-1 in a bad release, we support
|
||||||
|
@ -146,41 +148,41 @@ ALTER EXTENSION citus UPDATE TO '9.3-1';
|
||||||
|
|
||||||
ALTER EXTENSION citus UPDATE TO '9.2-4';
|
ALTER EXTENSION citus UPDATE TO '9.2-4';
|
||||||
-- Snapshot of state at 9.2-4
|
-- Snapshot of state at 9.2-4
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
|
|
||||||
-- Test downgrade to 9.2-4 from 9.3-2
|
-- Test downgrade to 9.2-4 from 9.3-2
|
||||||
ALTER EXTENSION citus UPDATE TO '9.3-2';
|
ALTER EXTENSION citus UPDATE TO '9.3-2';
|
||||||
ALTER EXTENSION citus UPDATE TO '9.2-4';
|
ALTER EXTENSION citus UPDATE TO '9.2-4';
|
||||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
|
|
||||||
-- Snapshot of state at 9.3-2
|
-- Snapshot of state at 9.3-2
|
||||||
ALTER EXTENSION citus UPDATE TO '9.3-2';
|
ALTER EXTENSION citus UPDATE TO '9.3-2';
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
|
|
||||||
-- Test downgrade to 9.3-2 from 9.4-1
|
-- Test downgrade to 9.3-2 from 9.4-1
|
||||||
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
||||||
ALTER EXTENSION citus UPDATE TO '9.3-2';
|
ALTER EXTENSION citus UPDATE TO '9.3-2';
|
||||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
|
|
||||||
-- Snapshot of state at 9.4-1
|
-- Snapshot of state at 9.4-1
|
||||||
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
|
|
||||||
-- Test upgrade paths for backported citus_pg_upgrade functions
|
-- Test upgrade paths for backported citus_pg_upgrade functions
|
||||||
ALTER EXTENSION citus UPDATE TO '9.4-2';
|
ALTER EXTENSION citus UPDATE TO '9.4-2';
|
||||||
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
||||||
-- Should be empty result, even though the downgrade doesn't undo the upgrade, the
|
-- Should be empty result, even though the downgrade doesn't undo the upgrade, the
|
||||||
-- function signature doesn't change, which is reflected here.
|
-- function signature doesn't change, which is reflected here.
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
|
|
||||||
ALTER EXTENSION citus UPDATE TO '9.4-2';
|
ALTER EXTENSION citus UPDATE TO '9.4-2';
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
|
|
||||||
-- Snapshot of state at 9.4-1
|
-- Snapshot of state at 9.4-1
|
||||||
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
|
|
||||||
-- Test downgrade to 9.4-1 from 9.5-1
|
-- Test downgrade to 9.4-1 from 9.5-1
|
||||||
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
||||||
|
@ -198,78 +200,66 @@ ROLLBACK;
|
||||||
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
||||||
|
|
||||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
|
|
||||||
-- Snapshot of state at 9.5-1
|
-- Snapshot of state at 9.5-1
|
||||||
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
|
|
||||||
-- Test upgrade paths for backported citus_pg_upgrade functions
|
-- Test upgrade paths for backported citus_pg_upgrade functions
|
||||||
ALTER EXTENSION citus UPDATE TO '9.5-2';
|
ALTER EXTENSION citus UPDATE TO '9.5-2';
|
||||||
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
||||||
-- Should be empty result, even though the downgrade doesn't undo the upgrade, the
|
-- Should be empty result, even though the downgrade doesn't undo the upgrade, the
|
||||||
-- function signature doesn't change, which is reflected here.
|
-- function signature doesn't change, which is reflected here.
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
|
|
||||||
ALTER EXTENSION citus UPDATE TO '9.5-2';
|
ALTER EXTENSION citus UPDATE TO '9.5-2';
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
|
|
||||||
-- Snapshot of state at 9.5-1
|
-- Snapshot of state at 9.5-1
|
||||||
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
|
|
||||||
-- Test downgrade to 9.5-1 from 10.0-1
|
-- We removed the upgrade paths to 10.0-1, 10.0-2 and 10.0-3 due to a bug that blocked
|
||||||
ALTER EXTENSION citus UPDATE TO '10.0-1';
|
-- upgrades to 10.0, Therefore we test upgrades to 10.0-4 instead
|
||||||
|
|
||||||
|
-- Test downgrade to 9.5-1 from 10.0-4
|
||||||
|
ALTER EXTENSION citus UPDATE TO '10.0-4';
|
||||||
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
||||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
|
|
||||||
-- Snapshot of state at 10.0-1
|
|
||||||
ALTER EXTENSION citus UPDATE TO '10.0-1';
|
|
||||||
SELECT * FROM print_extension_changes();
|
|
||||||
|
|
||||||
-- Test downgrade to 10.0-1 from 10.0-2
|
|
||||||
ALTER EXTENSION citus UPDATE TO '10.0-2';
|
|
||||||
ALTER EXTENSION citus UPDATE TO '10.0-1';
|
|
||||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
|
||||||
SELECT * FROM print_extension_changes();
|
|
||||||
|
|
||||||
-- Snapshot of state at 10.0-2
|
|
||||||
ALTER EXTENSION citus UPDATE TO '10.0-2';
|
|
||||||
SELECT * FROM print_extension_changes();
|
|
||||||
|
|
||||||
-- Test downgrade to 10.0-2 from 10.0-3
|
|
||||||
ALTER EXTENSION citus UPDATE TO '10.0-3';
|
|
||||||
ALTER EXTENSION citus UPDATE TO '10.0-2';
|
|
||||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
|
||||||
SELECT * FROM print_extension_changes();
|
|
||||||
|
|
||||||
-- Snapshot of state at 10.0-3
|
|
||||||
ALTER EXTENSION citus UPDATE TO '10.0-3';
|
|
||||||
SELECT * FROM print_extension_changes();
|
|
||||||
|
|
||||||
-- Test downgrade to 10.0-3 from 10.0-4
|
|
||||||
ALTER EXTENSION citus UPDATE TO '10.0-4';
|
|
||||||
ALTER EXTENSION citus UPDATE TO '10.0-3';
|
|
||||||
-- Should be empty result, even though the downgrade doesn't undo the upgrade, the
|
|
||||||
-- function signature doesn't change, which is reflected here.
|
|
||||||
SELECT * FROM print_extension_changes();
|
|
||||||
|
|
||||||
-- Snapshot of state at 10.0-4
|
-- Snapshot of state at 10.0-4
|
||||||
ALTER EXTENSION citus UPDATE TO '10.0-4';
|
ALTER EXTENSION citus UPDATE TO '10.0-4';
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
|
|
||||||
|
-- check that we depend on the existence of public schema, and we can not drop it now
|
||||||
|
DROP SCHEMA public;
|
||||||
|
|
||||||
|
-- verify that citus_tables view is on pg_catalog if public schema is absent.
|
||||||
|
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
||||||
|
DROP SCHEMA public;
|
||||||
|
ALTER EXTENSION citus UPDATE TO '10.0-4';
|
||||||
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
|
|
||||||
|
-- recreate public schema, and recreate citus_tables in the public schema by default
|
||||||
|
CREATE SCHEMA public;
|
||||||
|
GRANT ALL ON SCHEMA public TO public;
|
||||||
|
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
||||||
|
ALTER EXTENSION citus UPDATE TO '10.0-4';
|
||||||
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
|
|
||||||
-- Test downgrade to 10.0-4 from 10.1-1
|
-- Test downgrade to 10.0-4 from 10.1-1
|
||||||
ALTER EXTENSION citus UPDATE TO '10.1-1';
|
ALTER EXTENSION citus UPDATE TO '10.1-1';
|
||||||
ALTER EXTENSION citus UPDATE TO '10.0-4';
|
ALTER EXTENSION citus UPDATE TO '10.0-4';
|
||||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
|
|
||||||
-- Snapshot of state at 10.1-1
|
-- Snapshot of state at 10.1-1
|
||||||
ALTER EXTENSION citus UPDATE TO '10.1-1';
|
ALTER EXTENSION citus UPDATE TO '10.1-1';
|
||||||
SELECT * FROM print_extension_changes();
|
SELECT * FROM multi_extension.print_extension_changes();
|
||||||
|
|
||||||
DROP TABLE prev_objects, extension_diff;
|
DROP TABLE multi_extension.prev_objects, multi_extension.extension_diff;
|
||||||
|
|
||||||
-- show running version
|
-- show running version
|
||||||
SHOW citus.version;
|
SHOW citus.version;
|
||||||
|
@ -537,3 +527,4 @@ FROM test.maintenance_worker();
|
||||||
SELECT count(*) FROM pg_stat_activity WHERE application_name = 'Citus Maintenance Daemon';
|
SELECT count(*) FROM pg_stat_activity WHERE application_name = 'Citus Maintenance Daemon';
|
||||||
|
|
||||||
DROP TABLE version_mismatch_table;
|
DROP TABLE version_mismatch_table;
|
||||||
|
DROP SCHEMA multi_extension;
|
||||||
|
|
Loading…
Reference in New Issue