mirror of https://github.com/citusdata/citus.git
77 lines
4.1 KiB
Plaintext
77 lines
4.1 KiB
Plaintext
SET search_path = post_11_upgrade;
|
|
-- make sure that we always (re)sync the metadata
|
|
UPDATE pg_dist_node_metadata SET metadata=jsonb_set(metadata, '{partitioned_citus_table_exists_pre_11}', to_jsonb('true'::bool), true);
|
|
SELECT citus_finalize_upgrade_to_citus11(enforce_version_check:=false);
|
|
NOTICE: Preparing all the existing partitioned table indexes
|
|
NOTICE: Preparing to sync the metadata to all nodes
|
|
citus_finalize_upgrade_to_citus11
|
|
---------------------------------------------------------------------
|
|
t
|
|
(1 row)
|
|
|
|
-- tables are objects with Citus 11+
|
|
SELECT pg_identify_object_as_address(classid, objid, objsubid) FROM pg_catalog.pg_dist_object WHERE objid IN ('post_11_upgrade'::regnamespace, 'post_11_upgrade.part_table'::regclass, 'post_11_upgrade.sensors'::regclass, 'post_11_upgrade.func_in_transaction_def'::regproc, 'post_11_upgrade.partial_index_test_config'::regconfig, 'post_11_upgrade.my_type'::regtype) ORDER BY 1;
|
|
pg_identify_object_as_address
|
|
---------------------------------------------------------------------
|
|
(function,"{post_11_upgrade,func_in_transaction_def}",{})
|
|
(schema,{post_11_upgrade},{})
|
|
(table,"{post_11_upgrade,part_table}",{})
|
|
(table,"{post_11_upgrade,sensors}",{})
|
|
("text search configuration","{post_11_upgrade,partial_index_test_config}",{})
|
|
(type,{post_11_upgrade.my_type},{})
|
|
(6 rows)
|
|
|
|
-- on all nodes
|
|
SELECT run_command_on_workers($$SELECT array_agg(pg_identify_object_as_address(classid, objid, objsubid)) FROM pg_catalog.pg_dist_object WHERE objid IN ('post_11_upgrade'::regnamespace, 'post_11_upgrade.part_table'::regclass, 'post_11_upgrade.sensors'::regclass, 'post_11_upgrade.func_in_transaction_def'::regproc, 'post_11_upgrade.partial_index_test_config'::regconfig, 'post_11_upgrade.my_type'::regtype) ORDER BY 1;$$) ORDER BY 1;
|
|
run_command_on_workers
|
|
---------------------------------------------------------------------
|
|
(localhost,57636,t,"{""(type,{post_11_upgrade.my_type},{})"",""(function,\\""{post_11_upgrade,func_in_transaction_def}\\"",{})"",""(table,\\""{post_11_upgrade,part_table}\\"",{})"",""(table,\\""{post_11_upgrade,sensors}\\"",{})"",""(schema,{post_11_upgrade},{})"",""(\\""text search configuration\\"",\\""{post_11_upgrade,partial_index_test_config}\\"",{})""}")
|
|
(localhost,57637,t,"{""(type,{post_11_upgrade.my_type},{})"",""(function,\\""{post_11_upgrade,func_in_transaction_def}\\"",{})"",""(table,\\""{post_11_upgrade,part_table}\\"",{})"",""(table,\\""{post_11_upgrade,sensors}\\"",{})"",""(schema,{post_11_upgrade},{})"",""(\\""text search configuration\\"",\\""{post_11_upgrade,partial_index_test_config}\\"",{})""}")
|
|
(2 rows)
|
|
|
|
-- Create the necessary test utility function
|
|
CREATE OR REPLACE FUNCTION activate_node_snapshot()
|
|
RETURNS text[]
|
|
LANGUAGE C STRICT
|
|
AS 'citus';
|
|
-- make sure that workers and the coordinator has the same datesyle
|
|
SET datestyle = "ISO, YMD";
|
|
SELECT 1 FROM run_command_on_workers($$ALTER SYSTEM SET datestyle = "ISO, YMD";$$);
|
|
?column?
|
|
---------------------------------------------------------------------
|
|
1
|
|
1
|
|
(2 rows)
|
|
|
|
SELECT 1 FROM run_command_on_workers($$SELECT pg_reload_conf()$$);
|
|
?column?
|
|
---------------------------------------------------------------------
|
|
1
|
|
1
|
|
(2 rows)
|
|
|
|
-- make sure that the metadata is consistent across all nodes
|
|
-- we exclude the distributed_object_data as they are
|
|
-- not sorted in the same order (as OIDs differ on the nodes)
|
|
SELECT count(*) = 0 AS same_metadata_in_workers FROM
|
|
(
|
|
(
|
|
SELECT unnest(activate_node_snapshot()) as command
|
|
EXCEPT
|
|
SELECT unnest(result::text[]) AS command
|
|
FROM run_command_on_workers($$SELECT post_11_upgrade.activate_node_snapshot()$$)
|
|
)
|
|
UNION
|
|
(
|
|
SELECT unnest(result::text[]) AS command
|
|
FROM run_command_on_workers($$SELECT post_11_upgrade.activate_node_snapshot()$$)
|
|
EXCEPT
|
|
SELECT unnest(activate_node_snapshot()) as command
|
|
)
|
|
) AS foo WHERE command NOT ILIKE '%distributed_object_data%';
|
|
same_metadata_in_workers
|
|
---------------------------------------------------------------------
|
|
t
|
|
(1 row)
|
|
|