From cb4e53ad6ef164339ed259ecd8e938b34c87bcf3 Mon Sep 17 00:00:00 2001 From: Burak Velioglu Date: Thu, 10 Feb 2022 11:10:27 +0300 Subject: [PATCH] Fix mx tests --- .../citus_local_tables_queries_mx.out | 2 + .../expected/coordinator_evaluation.out | 2 + .../regress/expected/local_shard_copy.out | 2 + .../expected/local_shard_execution.out | 4 ++ .../local_shard_execution_replicated.out | 2 + .../expected/metadata_sync_helpers.out | 2 + .../expected/multi_mx_add_coordinator.out | 2 - src/test/regress/expected/multi_mx_call.out | 8 +-- src/test/regress/expected/multi_mx_call_0.out | 8 +-- .../expected/multi_mx_create_table.out | 46 ---------------- .../regress/expected/multi_mx_explain.out | 3 ++ .../multi_mx_function_call_delegation.out | 12 +---- .../multi_mx_function_call_delegation_0.out | 12 +---- .../regress/expected/multi_mx_metadata.out | 10 ---- .../expected/multi_mx_modifications.out | 2 + .../expected/multi_mx_modifying_xacts.out | 2 + .../expected/multi_mx_node_metadata.out | 2 + .../multi_mx_repartition_udt_prepare.out | 30 +---------- .../expected/multi_mx_router_planner.out | 2 + .../sql/citus_local_tables_queries_mx.sql | 2 + .../regress/sql/coordinator_evaluation.sql | 2 + src/test/regress/sql/local_shard_copy.sql | 2 + .../regress/sql/local_shard_execution.sql | 4 ++ .../sql/local_shard_execution_replicated.sql | 2 + .../regress/sql/metadata_sync_helpers.sql | 2 + src/test/regress/sql/multi_mx_call.sql | 2 + .../regress/sql/multi_mx_create_table.sql | 52 ------------------- src/test/regress/sql/multi_mx_explain.sql | 3 ++ .../sql/multi_mx_function_call_delegation.sql | 2 + src/test/regress/sql/multi_mx_metadata.sql | 11 ---- .../regress/sql/multi_mx_modifications.sql | 3 ++ .../regress/sql/multi_mx_modifying_xacts.sql | 2 + .../regress/sql/multi_mx_node_metadata.sql | 2 + .../sql/multi_mx_repartition_udt_prepare.sql | 36 +------------ .../regress/sql/multi_mx_router_planner.sql | 2 + 35 files changed, 67 insertions(+), 215 deletions(-) diff --git a/src/test/regress/expected/citus_local_tables_queries_mx.out b/src/test/regress/expected/citus_local_tables_queries_mx.out index 684644476..52b73e7df 100644 --- a/src/test/regress/expected/citus_local_tables_queries_mx.out +++ b/src/test/regress/expected/citus_local_tables_queries_mx.out @@ -58,6 +58,7 @@ CREATE TABLE postgres_local_table(a int, b int); -- We shouldn't use LIMIT in INSERT SELECT queries to make the test faster as -- LIMIT would force planner to wrap SELECT query in an intermediate result and -- this might reduce the coverage of the test cases. +SET citus.enable_metadata_sync TO OFF; CREATE FUNCTION clear_and_init_test_tables() RETURNS void AS $$ BEGIN SET client_min_messages to ERROR; @@ -74,6 +75,7 @@ CREATE FUNCTION clear_and_init_test_tables() RETURNS void AS $$ RESET client_min_messages; END; $$ LANGUAGE plpgsql; +RESET citus.enable_metadata_sync; --------------------------------------------------------------------- ---- SELECT ---- --------------------------------------------------------------------- diff --git a/src/test/regress/expected/coordinator_evaluation.out b/src/test/regress/expected/coordinator_evaluation.out index bd309bdb2..92b0d4c83 100644 --- a/src/test/regress/expected/coordinator_evaluation.out +++ b/src/test/regress/expected/coordinator_evaluation.out @@ -523,6 +523,7 @@ BEGIN RETURN trunc(random() * (end_int-start_int) + start_int); END; $$ LANGUAGE 'plpgsql' STRICT; +SET citus.enable_metadata_sync TO OFF; CREATE OR REPLACE PROCEDURE coordinator_evaluation.test_procedure(int) LANGUAGE plpgsql AS $procedure$ @@ -532,6 +533,7 @@ BEGIN PERFORM DISTINCT value FROM coordinator_evaluation_table_2 WHERE key = filterKey; END; $procedure$; +RESET citus.enable_metadata_sync; -- we couldn't find a meaningful query to write for this -- however this query fails before https://github.com/citusdata/citus/pull/3454 SET client_min_messages TO DEBUG2; diff --git a/src/test/regress/expected/local_shard_copy.out b/src/test/regress/expected/local_shard_copy.out index ec9828a04..33ef9f7df 100644 --- a/src/test/regress/expected/local_shard_copy.out +++ b/src/test/regress/expected/local_shard_copy.out @@ -62,6 +62,7 @@ SET citus.log_local_commands TO ON; -- returns true of the distribution key filter -- on the distributed tables (e.g., WHERE key = 1), we'll hit a shard -- placement which is local to this not +SET citus.enable_metadata_sync TO OFF; CREATE OR REPLACE FUNCTION shard_of_distribution_column_is_local(dist_key int) RETURNS bool AS $$ DECLARE shard_is_local BOOLEAN := FALSE; @@ -84,6 +85,7 @@ CREATE OR REPLACE FUNCTION shard_of_distribution_column_is_local(dist_key int) R RETURN shard_is_local; END; $$ LANGUAGE plpgsql; +RESET citus.enable_metadata_sync; -- pick some example values that reside on the shards locally and remote -- distribution key values of 1,6, 500 and 701 are LOCAL to shards, -- we'll use these values in the tests diff --git a/src/test/regress/expected/local_shard_execution.out b/src/test/regress/expected/local_shard_execution.out index 51daa4046..781a9c86c 100644 --- a/src/test/regress/expected/local_shard_execution.out +++ b/src/test/regress/expected/local_shard_execution.out @@ -94,6 +94,7 @@ SET search_path TO local_shard_execution; -- returns true of the distribution key filter -- on the distributed tables (e.g., WHERE key = 1), we'll hit a shard -- placement which is local to this not +SET citus.enable_metadata_sync TO OFF; CREATE OR REPLACE FUNCTION shard_of_distribution_column_is_local(dist_key int) RETURNS bool AS $$ DECLARE shard_is_local BOOLEAN := FALSE; @@ -116,6 +117,7 @@ CREATE OR REPLACE FUNCTION shard_of_distribution_column_is_local(dist_key int) R RETURN shard_is_local; END; $$ LANGUAGE plpgsql; +RESET citus.enable_metadata_sync; -- test case for issue #3556 SET citus.log_intermediate_results TO TRUE; SET client_min_messages TO DEBUG1; @@ -801,6 +803,7 @@ BEGIN; ERROR: VACUUM cannot run inside a transaction block ROLLBACK; -- make sure that functions can use local execution +SET citus.enable_metadata_sync TO OFF; CREATE OR REPLACE PROCEDURE only_local_execution() AS $$ DECLARE cnt INT; BEGIN @@ -896,6 +899,7 @@ CREATE OR REPLACE PROCEDURE local_execution_followed_by_dist() AS $$ SELECT count(*) INTO cnt FROM distributed_table; END; $$ LANGUAGE plpgsql; +RESET citus.enable_metadata_sync; CALL local_execution_followed_by_dist(); NOTICE: executing the command locally: INSERT INTO local_shard_execution.distributed_table_1470001 AS citus_table_alias (key, value, age) VALUES (1, '11'::text, 21) ON CONFLICT(key) DO UPDATE SET value = '29'::text CONTEXT: SQL statement "INSERT INTO distributed_table VALUES (1, '11',21) ON CONFLICT(key) DO UPDATE SET value = '29'" diff --git a/src/test/regress/expected/local_shard_execution_replicated.out b/src/test/regress/expected/local_shard_execution_replicated.out index 9d880f44b..731c825c3 100644 --- a/src/test/regress/expected/local_shard_execution_replicated.out +++ b/src/test/regress/expected/local_shard_execution_replicated.out @@ -770,6 +770,7 @@ NOTICE: executing the command locally: INSERT INTO local_shard_execution_replic ERROR: VACUUM cannot run inside a transaction block ROLLBACK; -- make sure that functions can use local execution +SET citus.enable_metadata_sync TO OFF; CREATE OR REPLACE PROCEDURE only_local_execution() AS $$ DECLARE cnt INT; BEGIN @@ -865,6 +866,7 @@ CREATE OR REPLACE PROCEDURE local_execution_followed_by_dist() AS $$ SELECT count(*) INTO cnt FROM distributed_table; END; $$ LANGUAGE plpgsql; +RESET citus.enable_metadata_sync; CALL local_execution_followed_by_dist(); NOTICE: executing the command locally: INSERT INTO local_shard_execution_replicated.distributed_table_1500001 AS citus_table_alias (key, value, age) VALUES (1, '11'::text, 21) ON CONFLICT(key) DO UPDATE SET value = '29'::text CONTEXT: SQL statement "INSERT INTO distributed_table VALUES (1, '11',21) ON CONFLICT(key) DO UPDATE SET value = '29'" diff --git a/src/test/regress/expected/metadata_sync_helpers.out b/src/test/regress/expected/metadata_sync_helpers.out index cb3b113e2..4dab1f790 100644 --- a/src/test/regress/expected/metadata_sync_helpers.out +++ b/src/test/regress/expected/metadata_sync_helpers.out @@ -948,6 +948,7 @@ BEGIN TRANSACTION ISOLATION LEVEL READ COMMITTED; ERROR: Node with group id 123123123 for shard placement xxxxx does not exist ROLLBACK; -- create a volatile function that returns the local node id +SET citus.enable_metadata_sync TO OFF; CREATE OR REPLACE FUNCTION get_node_id() RETURNS INT AS $$ DECLARE localGroupId int; @@ -960,6 +961,7 @@ BEGIN nodeport = 57637 AND nodename = 'localhost' AND isactive AND nodecluster = 'default'; RETURN localGroupId; END; $$ language plpgsql; +RESET citus.enable_metadata_sync; -- fails because we ingest more placements for the same shards to the same worker node BEGIN TRANSACTION ISOLATION LEVEL READ COMMITTED; SELECT assign_distributed_transaction_id(0, 8, '2021-07-09 15:41:55.542377+02'); diff --git a/src/test/regress/expected/multi_mx_add_coordinator.out b/src/test/regress/expected/multi_mx_add_coordinator.out index 33aec18d8..c46316974 100644 --- a/src/test/regress/expected/multi_mx_add_coordinator.out +++ b/src/test/regress/expected/multi_mx_add_coordinator.out @@ -140,8 +140,6 @@ BEGIN END; $$; SELECT create_distributed_function('my_group_id()', colocate_with := 'ref'); -DEBUG: switching to sequential query execution mode -DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands create_distributed_function --------------------------------------------------------------------- diff --git a/src/test/regress/expected/multi_mx_call.out b/src/test/regress/expected/multi_mx_call.out index 64b033d41..e98cd5eb2 100644 --- a/src/test/regress/expected/multi_mx_call.out +++ b/src/test/regress/expected/multi_mx_call.out @@ -402,6 +402,7 @@ select colocate_proc_with_table('mx_call_proc', 'mx_call_dist_table_1'::regclass -- Test that we handle transactional constructs correctly inside a procedure -- that is routed to the workers. +SET citus.enable_metadata_sync TO OFF; CREATE PROCEDURE mx_call_proc_tx(x int) LANGUAGE plpgsql AS $$ BEGIN INSERT INTO multi_mx_call.mx_call_dist_table_1 VALUES (x, -1), (x+1, 4); @@ -411,12 +412,11 @@ BEGIN -- Now do the final update! UPDATE multi_mx_call.mx_call_dist_table_1 SET val = val-1 WHERE id >= x; END;$$; +RESET citus.enable_metadata_sync; -- before distribution ... CALL multi_mx_call.mx_call_proc_tx(10); -- after distribution ... select create_distributed_function('mx_call_proc_tx(int)', '$1', 'mx_call_dist_table_1'); -DEBUG: switching to sequential query execution mode -DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands create_distributed_function --------------------------------------------------------------------- @@ -487,8 +487,6 @@ BEGIN RAISE EXCEPTION 'error'; END;$$; select create_distributed_function('mx_call_proc_raise(int)', '$1', 'mx_call_dist_table_1'); -DEBUG: switching to sequential query execution mode -DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands create_distributed_function --------------------------------------------------------------------- @@ -553,8 +551,6 @@ SET client_min_messages TO DEBUG1; CREATE FUNCTION mx_call_add(int, int) RETURNS int AS 'select $1 + $2;' LANGUAGE SQL IMMUTABLE; SELECT create_distributed_function('mx_call_add(int,int)'); -DEBUG: switching to sequential query execution mode -DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands create_distributed_function --------------------------------------------------------------------- diff --git a/src/test/regress/expected/multi_mx_call_0.out b/src/test/regress/expected/multi_mx_call_0.out index 496e735c9..c6917f07d 100644 --- a/src/test/regress/expected/multi_mx_call_0.out +++ b/src/test/regress/expected/multi_mx_call_0.out @@ -402,6 +402,7 @@ select colocate_proc_with_table('mx_call_proc', 'mx_call_dist_table_1'::regclass -- Test that we handle transactional constructs correctly inside a procedure -- that is routed to the workers. +SET citus.enable_metadata_sync TO OFF; CREATE PROCEDURE mx_call_proc_tx(x int) LANGUAGE plpgsql AS $$ BEGIN INSERT INTO multi_mx_call.mx_call_dist_table_1 VALUES (x, -1), (x+1, 4); @@ -411,12 +412,11 @@ BEGIN -- Now do the final update! UPDATE multi_mx_call.mx_call_dist_table_1 SET val = val-1 WHERE id >= x; END;$$; +RESET citus.enable_metadata_sync; -- before distribution ... CALL multi_mx_call.mx_call_proc_tx(10); -- after distribution ... select create_distributed_function('mx_call_proc_tx(int)', '$1', 'mx_call_dist_table_1'); -DEBUG: switching to sequential query execution mode -DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands create_distributed_function --------------------------------------------------------------------- @@ -487,8 +487,6 @@ BEGIN RAISE EXCEPTION 'error'; END;$$; select create_distributed_function('mx_call_proc_raise(int)', '$1', 'mx_call_dist_table_1'); -DEBUG: switching to sequential query execution mode -DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands create_distributed_function --------------------------------------------------------------------- @@ -553,8 +551,6 @@ SET client_min_messages TO DEBUG1; CREATE FUNCTION mx_call_add(int, int) RETURNS int AS 'select $1 + $2;' LANGUAGE SQL IMMUTABLE; SELECT create_distributed_function('mx_call_add(int,int)'); -DEBUG: switching to sequential query execution mode -DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands create_distributed_function --------------------------------------------------------------------- diff --git a/src/test/regress/expected/multi_mx_create_table.out b/src/test/regress/expected/multi_mx_create_table.out index 92c43b363..b103e02ae 100644 --- a/src/test/regress/expected/multi_mx_create_table.out +++ b/src/test/regress/expected/multi_mx_create_table.out @@ -66,30 +66,7 @@ HINT: Connect to the coordinator and run it again. -- create schema to test schema support CREATE SCHEMA citus_mx_test_schema_join_1; CREATE SCHEMA citus_mx_test_schema_join_2; --- create UDFs in worker node -CREATE OR REPLACE FUNCTION simpleTestFunction(theValue integer) - RETURNS text AS -$$ -DECLARE - strresult text; -BEGIN - RETURN theValue * 3 / 2 + 1; -END; -$$ -LANGUAGE 'plpgsql' IMMUTABLE; SET search_path TO citus_mx_test_schema; -CREATE OR REPLACE FUNCTION simpleTestFunction2(theValue integer) - RETURNS text AS -$$ -DECLARE - strresult text; -BEGIN - RETURN theValue * 3 / 2 + 1; -END; -$$ -LANGUAGE 'plpgsql' IMMUTABLE; -CREATE FUNCTION public.immutable_append_mx(old_values int[], new_value int) -RETURNS int[] AS $$ SELECT old_values || new_value $$ LANGUAGE SQL IMMUTABLE; -- create operator CREATE OPERATOR citus_mx_test_schema.=== ( LEFTARG = int, @@ -104,30 +81,7 @@ CREATE OPERATOR citus_mx_test_schema.=== ( -- create schema to test schema support CREATE SCHEMA citus_mx_test_schema_join_1; CREATE SCHEMA citus_mx_test_schema_join_2; --- create UDF -CREATE OR REPLACE FUNCTION simpleTestFunction(theValue integer) - RETURNS text AS -$$ -DECLARE - strresult text; -BEGIN - RETURN theValue * 3 / 2 + 1; -END; -$$ -LANGUAGE 'plpgsql' IMMUTABLE; SET search_path TO citus_mx_test_schema; -CREATE OR REPLACE FUNCTION simpleTestFunction2(theValue integer) - RETURNS text AS -$$ -DECLARE - strresult text; -BEGIN - RETURN theValue * 3 / 2 + 1; -END; -$$ -LANGUAGE 'plpgsql' IMMUTABLE; -CREATE FUNCTION public.immutable_append_mx(old_values int[], new_value int) -RETURNS int[] AS $$ SELECT old_values || new_value $$ LANGUAGE SQL IMMUTABLE; -- create operator CREATE OPERATOR citus_mx_test_schema.=== ( LEFTARG = int, diff --git a/src/test/regress/expected/multi_mx_explain.out b/src/test/regress/expected/multi_mx_explain.out index 2c58dd003..1c585a027 100644 --- a/src/test/regress/expected/multi_mx_explain.out +++ b/src/test/regress/expected/multi_mx_explain.out @@ -13,6 +13,7 @@ VACUUM ANALYZE customer_mx; VACUUM ANALYZE supplier_mx; \c - - - :worker_1_port -- Function that parses explain output as JSON +SET citus.enable_metadata_sync TO OFF; CREATE FUNCTION explain_json(query text) RETURNS jsonb AS $BODY$ @@ -36,6 +37,7 @@ END; $BODY$ LANGUAGE plpgsql; \c - - - :worker_2_port -- Function that parses explain output as JSON +SET citus.enable_metadata_sync TO OFF; CREATE FUNCTION explain_json(query text) RETURNS jsonb AS $BODY$ @@ -57,6 +59,7 @@ BEGIN RETURN result; END; $BODY$ LANGUAGE plpgsql; +RESET citus.enable_metadata_sync; -- Test Text format EXPLAIN (COSTS FALSE, FORMAT TEXT) SELECT l_quantity, count(*) count_quantity FROM lineitem_mx diff --git a/src/test/regress/expected/multi_mx_function_call_delegation.out b/src/test/regress/expected/multi_mx_function_call_delegation.out index d48f001bf..306ba8446 100644 --- a/src/test/regress/expected/multi_mx_function_call_delegation.out +++ b/src/test/regress/expected/multi_mx_function_call_delegation.out @@ -212,8 +212,6 @@ select colocate_proc_with_table('squares', 'mx_call_dist_table_2'::regclass, 0); select create_distributed_function('mx_call_func_bigint(bigint,bigint)', 'x', colocate_with := 'mx_call_dist_table_bigint'); -DEBUG: switching to sequential query execution mode -DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands create_distributed_function --------------------------------------------------------------------- @@ -223,8 +221,6 @@ DETAIL: A distributed function is created. To make sure subsequent commands see select create_distributed_function('mx_call_func_bigint_force(bigint,bigint)', 'x', colocate_with := 'mx_call_dist_table_2', force_delegation := true); -DEBUG: switching to sequential query execution mode -DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands create_distributed_function --------------------------------------------------------------------- @@ -396,6 +392,7 @@ select colocate_proc_with_table('mx_call_func', 'mx_call_dist_table_1'::regclass (1 row) -- Test table returning functions. +SET citus.enable_metadata_sync TO OFF; CREATE FUNCTION mx_call_func_tbl(x int) RETURNS TABLE (p0 int, p1 int) LANGUAGE plpgsql AS $$ @@ -409,6 +406,7 @@ BEGIN WHERE id >= x ORDER BY 1, 2; END;$$; +RESET citus.enable_metadata_sync; -- before distribution ... select mx_call_func_tbl(10); mx_call_func_tbl @@ -419,8 +417,6 @@ select mx_call_func_tbl(10); -- after distribution ... select create_distributed_function('mx_call_func_tbl(int)', '$1', 'mx_call_dist_table_1'); -DEBUG: switching to sequential query execution mode -DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands create_distributed_function --------------------------------------------------------------------- @@ -442,8 +438,6 @@ BEGIN RAISE EXCEPTION 'error'; END;$$; select create_distributed_function('mx_call_func_raise(int)', '$1', 'mx_call_dist_table_1'); -DEBUG: switching to sequential query execution mode -DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands create_distributed_function --------------------------------------------------------------------- @@ -594,8 +588,6 @@ SET citus.shard_replication_factor = 1; CREATE FUNCTION mx_call_add(int, int) RETURNS int AS 'select $1 + $2;' LANGUAGE SQL IMMUTABLE; SELECT create_distributed_function('mx_call_add(int,int)', '$1'); -DEBUG: switching to sequential query execution mode -DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands create_distributed_function --------------------------------------------------------------------- diff --git a/src/test/regress/expected/multi_mx_function_call_delegation_0.out b/src/test/regress/expected/multi_mx_function_call_delegation_0.out index 06a7b320d..4a405cfdc 100644 --- a/src/test/regress/expected/multi_mx_function_call_delegation_0.out +++ b/src/test/regress/expected/multi_mx_function_call_delegation_0.out @@ -212,8 +212,6 @@ select colocate_proc_with_table('squares', 'mx_call_dist_table_2'::regclass, 0); select create_distributed_function('mx_call_func_bigint(bigint,bigint)', 'x', colocate_with := 'mx_call_dist_table_bigint'); -DEBUG: switching to sequential query execution mode -DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands create_distributed_function --------------------------------------------------------------------- @@ -223,8 +221,6 @@ DETAIL: A distributed function is created. To make sure subsequent commands see select create_distributed_function('mx_call_func_bigint_force(bigint,bigint)', 'x', colocate_with := 'mx_call_dist_table_2', force_delegation := true); -DEBUG: switching to sequential query execution mode -DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands create_distributed_function --------------------------------------------------------------------- @@ -396,6 +392,7 @@ select colocate_proc_with_table('mx_call_func', 'mx_call_dist_table_1'::regclass (1 row) -- Test table returning functions. +SET citus.enable_metadata_sync TO OFF; CREATE FUNCTION mx_call_func_tbl(x int) RETURNS TABLE (p0 int, p1 int) LANGUAGE plpgsql AS $$ @@ -409,6 +406,7 @@ BEGIN WHERE id >= x ORDER BY 1, 2; END;$$; +RESET citus.enable_metadata_sync; -- before distribution ... select mx_call_func_tbl(10); mx_call_func_tbl @@ -419,8 +417,6 @@ select mx_call_func_tbl(10); -- after distribution ... select create_distributed_function('mx_call_func_tbl(int)', '$1', 'mx_call_dist_table_1'); -DEBUG: switching to sequential query execution mode -DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands create_distributed_function --------------------------------------------------------------------- @@ -442,8 +438,6 @@ BEGIN RAISE EXCEPTION 'error'; END;$$; select create_distributed_function('mx_call_func_raise(int)', '$1', 'mx_call_dist_table_1'); -DEBUG: switching to sequential query execution mode -DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands create_distributed_function --------------------------------------------------------------------- @@ -594,8 +588,6 @@ SET citus.shard_replication_factor = 1; CREATE FUNCTION mx_call_add(int, int) RETURNS int AS 'select $1 + $2;' LANGUAGE SQL IMMUTABLE; SELECT create_distributed_function('mx_call_add(int,int)', '$1'); -DEBUG: switching to sequential query execution mode -DETAIL: A distributed function is created. To make sure subsequent commands see the type correctly we need to make sure to use only one connection for all future commands create_distributed_function --------------------------------------------------------------------- diff --git a/src/test/regress/expected/multi_mx_metadata.out b/src/test/regress/expected/multi_mx_metadata.out index dc2365dda..a35b8edb1 100644 --- a/src/test/regress/expected/multi_mx_metadata.out +++ b/src/test/regress/expected/multi_mx_metadata.out @@ -344,16 +344,6 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='distributed_mx (3 rows) \c - no_access_mx - :worker_1_port --- see the comment in the top of the file -CREATE OR REPLACE FUNCTION raise_failed_aclcheck(query text) RETURNS void AS $$ -BEGIN - EXECUTE query; - EXCEPTION WHEN OTHERS THEN - IF SQLERRM LIKE 'must be owner of%' THEN - RAISE 'must be owner of the object'; - END IF; -END; -$$LANGUAGE plpgsql; SELECT raise_failed_aclcheck($$ DROP TABLE distributed_mx_table; $$); diff --git a/src/test/regress/expected/multi_mx_modifications.out b/src/test/regress/expected/multi_mx_modifications.out index c290c4e5a..276766c30 100644 --- a/src/test/regress/expected/multi_mx_modifications.out +++ b/src/test/regress/expected/multi_mx_modifications.out @@ -266,6 +266,7 @@ UPDATE limit_orders_mx SET array_of_values = 1 || array_of_values WHERE id = 246 -- immutable function calls with vars are also allowed UPDATE limit_orders_mx SET array_of_values = immutable_append_mx(array_of_values, 2) WHERE id = 246; +SET citus.enable_metadata_sync TO OFF; CREATE FUNCTION stable_append_mx(old_values int[], new_value int) RETURNS int[] AS $$ BEGIN RETURN old_values || new_value; END; $$ LANGUAGE plpgsql STABLE; @@ -282,6 +283,7 @@ SELECT array_of_values FROM limit_orders_mx WHERE id = 246; -- STRICT functions work as expected CREATE FUNCTION temp_strict_func(integer,integer) RETURNS integer AS 'SELECT COALESCE($1, 2) + COALESCE($1, 3);' LANGUAGE SQL STABLE STRICT; +RESET citus.enable_metadata_sync; UPDATE limit_orders_mx SET bidder_id = temp_strict_func(1, null) WHERE id = 246; ERROR: null value in column "bidder_id" violates not-null constraint SELECT array_of_values FROM limit_orders_mx WHERE id = 246; diff --git a/src/test/regress/expected/multi_mx_modifying_xacts.out b/src/test/regress/expected/multi_mx_modifying_xacts.out index 8c08673b2..e486b8b1b 100644 --- a/src/test/regress/expected/multi_mx_modifying_xacts.out +++ b/src/test/regress/expected/multi_mx_modifying_xacts.out @@ -227,6 +227,7 @@ SELECT * FROM objects_mx WHERE id = 1; -- create trigger on one worker to reject certain values \c - - - :worker_1_port +SET citus.enable_metadata_sync TO OFF; CREATE FUNCTION reject_bad_mx() RETURNS trigger AS $rb$ BEGIN IF (NEW.name = 'BAD') THEN @@ -236,6 +237,7 @@ CREATE FUNCTION reject_bad_mx() RETURNS trigger AS $rb$ RETURN NEW; END; $rb$ LANGUAGE plpgsql; +RESET citus.enable_metadata_sync; CREATE CONSTRAINT TRIGGER reject_bad_mx AFTER INSERT ON objects_mx_1220103 DEFERRABLE INITIALLY IMMEDIATE diff --git a/src/test/regress/expected/multi_mx_node_metadata.out b/src/test/regress/expected/multi_mx_node_metadata.out index d46f49caf..a4f49f320 100644 --- a/src/test/regress/expected/multi_mx_node_metadata.out +++ b/src/test/regress/expected/multi_mx_node_metadata.out @@ -829,10 +829,12 @@ SELECT master_update_node(nodeid, 'localhost', 12345) FROM pg_dist_node; (1 row) +SET citus.enable_metadata_sync TO OFF; CREATE OR REPLACE FUNCTION trigger_metadata_sync() RETURNS void LANGUAGE C STRICT AS 'citus'; +RESET citus.enable_metadata_sync; SELECT trigger_metadata_sync(); trigger_metadata_sync --------------------------------------------------------------------- diff --git a/src/test/regress/expected/multi_mx_repartition_udt_prepare.out b/src/test/regress/expected/multi_mx_repartition_udt_prepare.out index 114e55a0f..c9357e954 100644 --- a/src/test/regress/expected/multi_mx_repartition_udt_prepare.out +++ b/src/test/regress/expected/multi_mx_repartition_udt_prepare.out @@ -52,13 +52,7 @@ CREATE TABLE repartition_udt_other ( -- so that the OID is off. \c - - - :worker_1_port -- START type creation --- ... as well as a function to use as its comparator... -CREATE FUNCTION equal_test_udt_function(test_udt, test_udt) RETURNS boolean -AS 'select $1.i = $2.i AND $1.i2 = $2.i2;' -LANGUAGE SQL -IMMUTABLE -RETURNS NULL ON NULL INPUT; --- ... use that function to create a custom equality operator... +-- Use function to create a custom equality operator... CREATE OPERATOR = ( LEFTARG = test_udt, RIGHTARG = test_udt, @@ -68,13 +62,6 @@ CREATE OPERATOR = ( ); -- ... and create a custom operator family for hash indexes... CREATE OPERATOR FAMILY tudt_op_fam USING hash; --- ... create a test HASH function. Though it is a poor hash function, --- it is acceptable for our tests -CREATE FUNCTION test_udt_hash(test_udt) RETURNS int -AS 'SELECT hashtext( ($1.i + $1.i2)::text);' -LANGUAGE SQL -IMMUTABLE -RETURNS NULL ON NULL INPUT; -- We need to define two different operator classes for the composite types -- One uses BTREE the other uses HASH CREATE OPERATOR CLASS tudt_op_fam_clas3 @@ -87,13 +74,7 @@ FUNCTION 1 test_udt_hash(test_udt); -- END type creation \c - - - :worker_2_port -- START type creation --- ... as well as a function to use as its comparator... -CREATE FUNCTION equal_test_udt_function(test_udt, test_udt) RETURNS boolean -AS 'select $1.i = $2.i AND $1.i2 = $2.i2;' -LANGUAGE SQL -IMMUTABLE -RETURNS NULL ON NULL INPUT; --- ... use that function to create a custom equality operator... +-- Use function to create a custom equality operator... CREATE OPERATOR = ( LEFTARG = test_udt, RIGHTARG = test_udt, @@ -103,13 +84,6 @@ CREATE OPERATOR = ( ); -- ... and create a custom operator family for hash indexes... CREATE OPERATOR FAMILY tudt_op_fam USING hash; --- ... create a test HASH function. Though it is a poor hash function, --- it is acceptable for our tests -CREATE FUNCTION test_udt_hash(test_udt) RETURNS int -AS 'SELECT hashtext( ($1.i + $1.i2)::text);' -LANGUAGE SQL -IMMUTABLE -RETURNS NULL ON NULL INPUT; -- We need to define two different operator classes for the composite types -- One uses BTREE the other uses HASH CREATE OPERATOR CLASS tudt_op_fam_clas3 diff --git a/src/test/regress/expected/multi_mx_router_planner.out b/src/test/regress/expected/multi_mx_router_planner.out index 4dcbac57e..d006b4bb8 100644 --- a/src/test/regress/expected/multi_mx_router_planner.out +++ b/src/test/regress/expected/multi_mx_router_planner.out @@ -1363,6 +1363,7 @@ DEBUG: query has a single distribution column value: 1 (5 rows) -- queries inside plpgsql functions could be router plannable +SET citus.enable_metadata_sync TO OFF; CREATE OR REPLACE FUNCTION author_articles_max_id() RETURNS int AS $$ DECLARE max_id integer; @@ -1418,6 +1419,7 @@ PL/pgSQL function author_articles_id_word_count() line XX at RETURN QUERY 41 | 11814 (5 rows) +RESET citus.enable_metadata_sync; -- materialized views can be created for router plannable queries CREATE MATERIALIZED VIEW mv_articles_hash_mx AS SELECT * FROM articles_hash_mx WHERE author_id = 1; diff --git a/src/test/regress/sql/citus_local_tables_queries_mx.sql b/src/test/regress/sql/citus_local_tables_queries_mx.sql index f4a53bffc..ddcc95d84 100644 --- a/src/test/regress/sql/citus_local_tables_queries_mx.sql +++ b/src/test/regress/sql/citus_local_tables_queries_mx.sql @@ -43,6 +43,7 @@ CREATE TABLE postgres_local_table(a int, b int); -- We shouldn't use LIMIT in INSERT SELECT queries to make the test faster as -- LIMIT would force planner to wrap SELECT query in an intermediate result and -- this might reduce the coverage of the test cases. +SET citus.enable_metadata_sync TO OFF; CREATE FUNCTION clear_and_init_test_tables() RETURNS void AS $$ BEGIN SET client_min_messages to ERROR; @@ -59,6 +60,7 @@ CREATE FUNCTION clear_and_init_test_tables() RETURNS void AS $$ RESET client_min_messages; END; $$ LANGUAGE plpgsql; +RESET citus.enable_metadata_sync; ---------------- ---- SELECT ---- diff --git a/src/test/regress/sql/coordinator_evaluation.sql b/src/test/regress/sql/coordinator_evaluation.sql index e7479fd1a..1f313a76a 100644 --- a/src/test/regress/sql/coordinator_evaluation.sql +++ b/src/test/regress/sql/coordinator_evaluation.sql @@ -165,6 +165,7 @@ BEGIN END; $$ LANGUAGE 'plpgsql' STRICT; +SET citus.enable_metadata_sync TO OFF; CREATE OR REPLACE PROCEDURE coordinator_evaluation.test_procedure(int) LANGUAGE plpgsql AS $procedure$ @@ -174,6 +175,7 @@ BEGIN PERFORM DISTINCT value FROM coordinator_evaluation_table_2 WHERE key = filterKey; END; $procedure$; +RESET citus.enable_metadata_sync; -- we couldn't find a meaningful query to write for this -- however this query fails before https://github.com/citusdata/citus/pull/3454 diff --git a/src/test/regress/sql/local_shard_copy.sql b/src/test/regress/sql/local_shard_copy.sql index 688ba8b4b..094ba8fb4 100644 --- a/src/test/regress/sql/local_shard_copy.sql +++ b/src/test/regress/sql/local_shard_copy.sql @@ -48,6 +48,7 @@ SET citus.log_local_commands TO ON; -- returns true of the distribution key filter -- on the distributed tables (e.g., WHERE key = 1), we'll hit a shard -- placement which is local to this not +SET citus.enable_metadata_sync TO OFF; CREATE OR REPLACE FUNCTION shard_of_distribution_column_is_local(dist_key int) RETURNS bool AS $$ DECLARE shard_is_local BOOLEAN := FALSE; @@ -70,6 +71,7 @@ CREATE OR REPLACE FUNCTION shard_of_distribution_column_is_local(dist_key int) R RETURN shard_is_local; END; $$ LANGUAGE plpgsql; +RESET citus.enable_metadata_sync; -- pick some example values that reside on the shards locally and remote diff --git a/src/test/regress/sql/local_shard_execution.sql b/src/test/regress/sql/local_shard_execution.sql index 6bda63d8d..c7dad6f00 100644 --- a/src/test/regress/sql/local_shard_execution.sql +++ b/src/test/regress/sql/local_shard_execution.sql @@ -71,6 +71,7 @@ SET search_path TO local_shard_execution; -- returns true of the distribution key filter -- on the distributed tables (e.g., WHERE key = 1), we'll hit a shard -- placement which is local to this not +SET citus.enable_metadata_sync TO OFF; CREATE OR REPLACE FUNCTION shard_of_distribution_column_is_local(dist_key int) RETURNS bool AS $$ DECLARE shard_is_local BOOLEAN := FALSE; @@ -93,6 +94,7 @@ CREATE OR REPLACE FUNCTION shard_of_distribution_column_is_local(dist_key int) R RETURN shard_is_local; END; $$ LANGUAGE plpgsql; +RESET citus.enable_metadata_sync; -- test case for issue #3556 SET citus.log_intermediate_results TO TRUE; @@ -418,6 +420,7 @@ BEGIN; ROLLBACK; -- make sure that functions can use local execution +SET citus.enable_metadata_sync TO OFF; CREATE OR REPLACE PROCEDURE only_local_execution() AS $$ DECLARE cnt INT; BEGIN @@ -491,6 +494,7 @@ CREATE OR REPLACE PROCEDURE local_execution_followed_by_dist() AS $$ SELECT count(*) INTO cnt FROM distributed_table; END; $$ LANGUAGE plpgsql; +RESET citus.enable_metadata_sync; CALL local_execution_followed_by_dist(); diff --git a/src/test/regress/sql/local_shard_execution_replicated.sql b/src/test/regress/sql/local_shard_execution_replicated.sql index a341ac619..01af172a3 100644 --- a/src/test/regress/sql/local_shard_execution_replicated.sql +++ b/src/test/regress/sql/local_shard_execution_replicated.sql @@ -384,6 +384,7 @@ BEGIN; ROLLBACK; -- make sure that functions can use local execution +SET citus.enable_metadata_sync TO OFF; CREATE OR REPLACE PROCEDURE only_local_execution() AS $$ DECLARE cnt INT; BEGIN @@ -457,6 +458,7 @@ CREATE OR REPLACE PROCEDURE local_execution_followed_by_dist() AS $$ SELECT count(*) INTO cnt FROM distributed_table; END; $$ LANGUAGE plpgsql; +RESET citus.enable_metadata_sync; CALL local_execution_followed_by_dist(); diff --git a/src/test/regress/sql/metadata_sync_helpers.sql b/src/test/regress/sql/metadata_sync_helpers.sql index 22e337443..611e90fdc 100644 --- a/src/test/regress/sql/metadata_sync_helpers.sql +++ b/src/test/regress/sql/metadata_sync_helpers.sql @@ -609,6 +609,7 @@ BEGIN TRANSACTION ISOLATION LEVEL READ COMMITTED; ROLLBACK; -- create a volatile function that returns the local node id +SET citus.enable_metadata_sync TO OFF; CREATE OR REPLACE FUNCTION get_node_id() RETURNS INT AS $$ DECLARE localGroupId int; @@ -621,6 +622,7 @@ BEGIN nodeport = 57637 AND nodename = 'localhost' AND isactive AND nodecluster = 'default'; RETURN localGroupId; END; $$ language plpgsql; +RESET citus.enable_metadata_sync; -- fails because we ingest more placements for the same shards to the same worker node BEGIN TRANSACTION ISOLATION LEVEL READ COMMITTED; diff --git a/src/test/regress/sql/multi_mx_call.sql b/src/test/regress/sql/multi_mx_call.sql index 4728b8948..ccdffd9aa 100644 --- a/src/test/regress/sql/multi_mx_call.sql +++ b/src/test/regress/sql/multi_mx_call.sql @@ -180,6 +180,7 @@ select colocate_proc_with_table('mx_call_proc', 'mx_call_dist_table_1'::regclass -- Test that we handle transactional constructs correctly inside a procedure -- that is routed to the workers. +SET citus.enable_metadata_sync TO OFF; CREATE PROCEDURE mx_call_proc_tx(x int) LANGUAGE plpgsql AS $$ BEGIN INSERT INTO multi_mx_call.mx_call_dist_table_1 VALUES (x, -1), (x+1, 4); @@ -189,6 +190,7 @@ BEGIN -- Now do the final update! UPDATE multi_mx_call.mx_call_dist_table_1 SET val = val-1 WHERE id >= x; END;$$; +RESET citus.enable_metadata_sync; -- before distribution ... CALL multi_mx_call.mx_call_proc_tx(10); diff --git a/src/test/regress/sql/multi_mx_create_table.sql b/src/test/regress/sql/multi_mx_create_table.sql index be391318a..eac0795ca 100644 --- a/src/test/regress/sql/multi_mx_create_table.sql +++ b/src/test/regress/sql/multi_mx_create_table.sql @@ -67,33 +67,7 @@ SELECT citus_add_local_table_to_metadata('citus_local_table'); CREATE SCHEMA citus_mx_test_schema_join_1; CREATE SCHEMA citus_mx_test_schema_join_2; --- create UDFs in worker node -CREATE OR REPLACE FUNCTION simpleTestFunction(theValue integer) - RETURNS text AS -$$ -DECLARE - strresult text; -BEGIN - RETURN theValue * 3 / 2 + 1; -END; -$$ -LANGUAGE 'plpgsql' IMMUTABLE; - SET search_path TO citus_mx_test_schema; -CREATE OR REPLACE FUNCTION simpleTestFunction2(theValue integer) - RETURNS text AS -$$ -DECLARE - strresult text; -BEGIN - RETURN theValue * 3 / 2 + 1; -END; -$$ -LANGUAGE 'plpgsql' IMMUTABLE; - -CREATE FUNCTION public.immutable_append_mx(old_values int[], new_value int) -RETURNS int[] AS $$ SELECT old_values || new_value $$ LANGUAGE SQL IMMUTABLE; - -- create operator CREATE OPERATOR citus_mx_test_schema.=== ( LEFTARG = int, @@ -111,33 +85,7 @@ CREATE OPERATOR citus_mx_test_schema.=== ( CREATE SCHEMA citus_mx_test_schema_join_1; CREATE SCHEMA citus_mx_test_schema_join_2; - --- create UDF -CREATE OR REPLACE FUNCTION simpleTestFunction(theValue integer) - RETURNS text AS -$$ -DECLARE - strresult text; -BEGIN - RETURN theValue * 3 / 2 + 1; -END; -$$ -LANGUAGE 'plpgsql' IMMUTABLE; - SET search_path TO citus_mx_test_schema; -CREATE OR REPLACE FUNCTION simpleTestFunction2(theValue integer) - RETURNS text AS -$$ -DECLARE - strresult text; -BEGIN - RETURN theValue * 3 / 2 + 1; -END; -$$ -LANGUAGE 'plpgsql' IMMUTABLE; - -CREATE FUNCTION public.immutable_append_mx(old_values int[], new_value int) -RETURNS int[] AS $$ SELECT old_values || new_value $$ LANGUAGE SQL IMMUTABLE; -- create operator CREATE OPERATOR citus_mx_test_schema.=== ( diff --git a/src/test/regress/sql/multi_mx_explain.sql b/src/test/regress/sql/multi_mx_explain.sql index 9417b94f3..347d79d67 100644 --- a/src/test/regress/sql/multi_mx_explain.sql +++ b/src/test/regress/sql/multi_mx_explain.sql @@ -18,6 +18,7 @@ VACUUM ANALYZE supplier_mx; \c - - - :worker_1_port -- Function that parses explain output as JSON +SET citus.enable_metadata_sync TO OFF; CREATE FUNCTION explain_json(query text) RETURNS jsonb AS $BODY$ @@ -43,6 +44,7 @@ $BODY$ LANGUAGE plpgsql; \c - - - :worker_2_port -- Function that parses explain output as JSON +SET citus.enable_metadata_sync TO OFF; CREATE FUNCTION explain_json(query text) RETURNS jsonb AS $BODY$ @@ -65,6 +67,7 @@ BEGIN RETURN result; END; $BODY$ LANGUAGE plpgsql; +RESET citus.enable_metadata_sync; -- Test Text format diff --git a/src/test/regress/sql/multi_mx_function_call_delegation.sql b/src/test/regress/sql/multi_mx_function_call_delegation.sql index 206969456..e807437dd 100644 --- a/src/test/regress/sql/multi_mx_function_call_delegation.sql +++ b/src/test/regress/sql/multi_mx_function_call_delegation.sql @@ -166,6 +166,7 @@ SET client_min_messages TO DEBUG1; select colocate_proc_with_table('mx_call_func', 'mx_call_dist_table_1'::regclass, 1); -- Test table returning functions. +SET citus.enable_metadata_sync TO OFF; CREATE FUNCTION mx_call_func_tbl(x int) RETURNS TABLE (p0 int, p1 int) LANGUAGE plpgsql AS $$ @@ -179,6 +180,7 @@ BEGIN WHERE id >= x ORDER BY 1, 2; END;$$; +RESET citus.enable_metadata_sync; -- before distribution ... select mx_call_func_tbl(10); diff --git a/src/test/regress/sql/multi_mx_metadata.sql b/src/test/regress/sql/multi_mx_metadata.sql index 7bd09b900..169f3aa8b 100644 --- a/src/test/regress/sql/multi_mx_metadata.sql +++ b/src/test/regress/sql/multi_mx_metadata.sql @@ -218,17 +218,6 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='distributed_mx \c - no_access_mx - :worker_1_port --- see the comment in the top of the file -CREATE OR REPLACE FUNCTION raise_failed_aclcheck(query text) RETURNS void AS $$ -BEGIN - EXECUTE query; - EXCEPTION WHEN OTHERS THEN - IF SQLERRM LIKE 'must be owner of%' THEN - RAISE 'must be owner of the object'; - END IF; -END; -$$LANGUAGE plpgsql; - SELECT raise_failed_aclcheck($$ DROP TABLE distributed_mx_table; $$); diff --git a/src/test/regress/sql/multi_mx_modifications.sql b/src/test/regress/sql/multi_mx_modifications.sql index 72ad17b65..852bf3a42 100644 --- a/src/test/regress/sql/multi_mx_modifications.sql +++ b/src/test/regress/sql/multi_mx_modifications.sql @@ -202,6 +202,7 @@ UPDATE limit_orders_mx SET array_of_values = 1 || array_of_values WHERE id = 246 UPDATE limit_orders_mx SET array_of_values = immutable_append_mx(array_of_values, 2) WHERE id = 246; +SET citus.enable_metadata_sync TO OFF; CREATE FUNCTION stable_append_mx(old_values int[], new_value int) RETURNS int[] AS $$ BEGIN RETURN old_values || new_value; END; $$ LANGUAGE plpgsql STABLE; @@ -215,6 +216,8 @@ SELECT array_of_values FROM limit_orders_mx WHERE id = 246; -- STRICT functions work as expected CREATE FUNCTION temp_strict_func(integer,integer) RETURNS integer AS 'SELECT COALESCE($1, 2) + COALESCE($1, 3);' LANGUAGE SQL STABLE STRICT; +RESET citus.enable_metadata_sync; + UPDATE limit_orders_mx SET bidder_id = temp_strict_func(1, null) WHERE id = 246; SELECT array_of_values FROM limit_orders_mx WHERE id = 246; diff --git a/src/test/regress/sql/multi_mx_modifying_xacts.sql b/src/test/regress/sql/multi_mx_modifying_xacts.sql index 2c7d65b7c..cf60f023d 100644 --- a/src/test/regress/sql/multi_mx_modifying_xacts.sql +++ b/src/test/regress/sql/multi_mx_modifying_xacts.sql @@ -195,6 +195,7 @@ SELECT * FROM objects_mx WHERE id = 1; -- create trigger on one worker to reject certain values \c - - - :worker_1_port +SET citus.enable_metadata_sync TO OFF; CREATE FUNCTION reject_bad_mx() RETURNS trigger AS $rb$ BEGIN IF (NEW.name = 'BAD') THEN @@ -204,6 +205,7 @@ CREATE FUNCTION reject_bad_mx() RETURNS trigger AS $rb$ RETURN NEW; END; $rb$ LANGUAGE plpgsql; +RESET citus.enable_metadata_sync; CREATE CONSTRAINT TRIGGER reject_bad_mx AFTER INSERT ON objects_mx_1220103 diff --git a/src/test/regress/sql/multi_mx_node_metadata.sql b/src/test/regress/sql/multi_mx_node_metadata.sql index 09e8e49f1..020aba771 100644 --- a/src/test/regress/sql/multi_mx_node_metadata.sql +++ b/src/test/regress/sql/multi_mx_node_metadata.sql @@ -367,10 +367,12 @@ UPDATE pg_dist_node SET hasmetadata = true; SELECT master_update_node(nodeid, 'localhost', 12345) FROM pg_dist_node; +SET citus.enable_metadata_sync TO OFF; CREATE OR REPLACE FUNCTION trigger_metadata_sync() RETURNS void LANGUAGE C STRICT AS 'citus'; +RESET citus.enable_metadata_sync; SELECT trigger_metadata_sync(); diff --git a/src/test/regress/sql/multi_mx_repartition_udt_prepare.sql b/src/test/regress/sql/multi_mx_repartition_udt_prepare.sql index a2663c7a4..779f4c24e 100644 --- a/src/test/regress/sql/multi_mx_repartition_udt_prepare.sql +++ b/src/test/regress/sql/multi_mx_repartition_udt_prepare.sql @@ -68,14 +68,7 @@ CREATE TABLE repartition_udt_other ( \c - - - :worker_1_port -- START type creation --- ... as well as a function to use as its comparator... -CREATE FUNCTION equal_test_udt_function(test_udt, test_udt) RETURNS boolean -AS 'select $1.i = $2.i AND $1.i2 = $2.i2;' -LANGUAGE SQL -IMMUTABLE -RETURNS NULL ON NULL INPUT; - --- ... use that function to create a custom equality operator... +-- Use function to create a custom equality operator... CREATE OPERATOR = ( LEFTARG = test_udt, RIGHTARG = test_udt, @@ -87,15 +80,6 @@ CREATE OPERATOR = ( -- ... and create a custom operator family for hash indexes... CREATE OPERATOR FAMILY tudt_op_fam USING hash; --- ... create a test HASH function. Though it is a poor hash function, --- it is acceptable for our tests -CREATE FUNCTION test_udt_hash(test_udt) RETURNS int -AS 'SELECT hashtext( ($1.i + $1.i2)::text);' -LANGUAGE SQL -IMMUTABLE -RETURNS NULL ON NULL INPUT; - - -- We need to define two different operator classes for the composite types -- One uses BTREE the other uses HASH CREATE OPERATOR CLASS tudt_op_fam_clas3 @@ -112,14 +96,7 @@ FUNCTION 1 test_udt_hash(test_udt); \c - - - :worker_2_port -- START type creation --- ... as well as a function to use as its comparator... -CREATE FUNCTION equal_test_udt_function(test_udt, test_udt) RETURNS boolean -AS 'select $1.i = $2.i AND $1.i2 = $2.i2;' -LANGUAGE SQL -IMMUTABLE -RETURNS NULL ON NULL INPUT; - --- ... use that function to create a custom equality operator... +-- Use function to create a custom equality operator... CREATE OPERATOR = ( LEFTARG = test_udt, RIGHTARG = test_udt, @@ -131,15 +108,6 @@ CREATE OPERATOR = ( -- ... and create a custom operator family for hash indexes... CREATE OPERATOR FAMILY tudt_op_fam USING hash; --- ... create a test HASH function. Though it is a poor hash function, --- it is acceptable for our tests -CREATE FUNCTION test_udt_hash(test_udt) RETURNS int -AS 'SELECT hashtext( ($1.i + $1.i2)::text);' -LANGUAGE SQL -IMMUTABLE -RETURNS NULL ON NULL INPUT; - - -- We need to define two different operator classes for the composite types -- One uses BTREE the other uses HASH CREATE OPERATOR CLASS tudt_op_fam_clas3 diff --git a/src/test/regress/sql/multi_mx_router_planner.sql b/src/test/regress/sql/multi_mx_router_planner.sql index e8efbe244..fdfd81b07 100644 --- a/src/test/regress/sql/multi_mx_router_planner.sql +++ b/src/test/regress/sql/multi_mx_router_planner.sql @@ -609,6 +609,7 @@ PREPARE author_articles(int) as EXECUTE author_articles(1); -- queries inside plpgsql functions could be router plannable +SET citus.enable_metadata_sync TO OFF; CREATE OR REPLACE FUNCTION author_articles_max_id() RETURNS int AS $$ DECLARE max_id integer; @@ -635,6 +636,7 @@ END; $$ LANGUAGE plpgsql; SELECT * FROM author_articles_id_word_count(); +RESET citus.enable_metadata_sync; -- materialized views can be created for router plannable queries CREATE MATERIALIZED VIEW mv_articles_hash_mx AS