Fix downgrade scripts and add new downgrade tests

pull/5941/head
Marco Slot 2022-05-13 11:46:42 +02:00
parent 4fe43c68bc
commit fa9cee409c
4 changed files with 37 additions and 3 deletions

View File

@ -1,4 +1,14 @@
#include "../udfs/citus_shards_on_worker/11.0-1.sql"
#include "../udfs/citus_shard_indexes_on_worker/11.0-1.sql"
#include "../udfs/citus_disable_node/11.0-1.sql"
DROP FUNCTION pg_catalog.citus_disable_node(text, integer, bool);
CREATE FUNCTION pg_catalog.citus_disable_node(nodename text, nodeport integer, force bool default false)
RETURNS void
LANGUAGE C STRICT
AS 'MODULE_PATHNAME', $$citus_disable_node$$;
COMMENT ON FUNCTION pg_catalog.citus_disable_node(nodename text, nodeport integer, force bool)
IS 'removes node from the cluster temporarily';
REVOKE ALL ON FUNCTION pg_catalog.citus_disable_node(text,int, bool) FROM PUBLIC;
DROP FUNCTION pg_catalog.citus_is_coordinator();

View File

@ -45,5 +45,3 @@ CREATE FUNCTION pg_catalog.worker_repartition_cleanup(bigint)
LANGUAGE c
STRICT
AS 'MODULE_PATHNAME', $function$worker_repartition_cleanup$function$
DROP FUNCTION pg_catalog.citus_is_coordinator();

View File

@ -1039,6 +1039,14 @@ SELECT * FROM multi_extension.print_extension_changes();
| function citus_is_coordinator() boolean
(1 row)
-- Test downgrade script (result should be empty)
ALTER EXTENSION citus UPDATE TO '11.0-1';
ALTER EXTENSION citus UPDATE TO '11.0-2';
SELECT * FROM multi_extension.print_extension_changes();
previous_object | current_object
---------------------------------------------------------------------
(0 rows)
-- Snapshot of state at 11.1-1
ALTER EXTENSION citus UPDATE TO '11.1-1';
SELECT * FROM multi_extension.print_extension_changes();
@ -1054,6 +1062,14 @@ SELECT * FROM multi_extension.print_extension_changes();
function worker_repartition_cleanup(bigint) void |
(8 rows)
-- Test downgrade script (result should be empty)
ALTER EXTENSION citus UPDATE TO '11.0-2';
ALTER EXTENSION citus UPDATE TO '11.1-1';
SELECT * FROM multi_extension.print_extension_changes();
previous_object | current_object
---------------------------------------------------------------------
(0 rows)
DROP TABLE multi_extension.prev_objects, multi_extension.extension_diff;
-- show running version
SHOW citus.version;

View File

@ -463,10 +463,20 @@ SELECT * FROM multi_extension.print_extension_changes();
ALTER EXTENSION citus UPDATE TO '11.0-2';
SELECT * FROM multi_extension.print_extension_changes();
-- Test downgrade script (result should be empty)
ALTER EXTENSION citus UPDATE TO '11.0-1';
ALTER EXTENSION citus UPDATE TO '11.0-2';
SELECT * FROM multi_extension.print_extension_changes();
-- Snapshot of state at 11.1-1
ALTER EXTENSION citus UPDATE TO '11.1-1';
SELECT * FROM multi_extension.print_extension_changes();
-- Test downgrade script (result should be empty)
ALTER EXTENSION citus UPDATE TO '11.0-2';
ALTER EXTENSION citus UPDATE TO '11.1-1';
SELECT * FROM multi_extension.print_extension_changes();
DROP TABLE multi_extension.prev_objects, multi_extension.extension_diff;
-- show running version