Merge pull request #3604 from citusdata/prevent_worker_mx_create_dist_f

Prevent create_distributed_function() from the workers
pull/3605/head^2
Önder Kalacı 2020-03-11 09:47:41 +01:00 committed by GitHub
commit f7f0fff304
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 0 deletions

View File

@ -148,6 +148,7 @@ create_distributed_function(PG_FUNCTION_ARGS)
colocateWithTableName = text_to_cstring(colocateWithText); colocateWithTableName = text_to_cstring(colocateWithText);
} }
EnsureCoordinator();
EnsureFunctionOwner(funcOid); EnsureFunctionOwner(funcOid);
ObjectAddressSet(functionAddress, ProcedureRelationId, funcOid); ObjectAddressSet(functionAddress, ProcedureRelationId, funcOid);

View File

@ -692,6 +692,14 @@ DEBUG: pushing down the function call
28 28
(1 row) (1 row)
\c - - - :worker_1_port
SET search_path TO multi_mx_function_call_delegation, public;
-- create_distributed_function is disallowed from worker nodes
select create_distributed_function('mx_call_func(int,int)');
ERROR: operation is not allowed on this node
HINT: Connect to the coordinator and run it again.
\c - - - :master_port
SET search_path TO multi_mx_function_call_delegation, public;
RESET client_min_messages; RESET client_min_messages;
\set VERBOSITY terse \set VERBOSITY terse
DROP SCHEMA multi_mx_function_call_delegation CASCADE; DROP SCHEMA multi_mx_function_call_delegation CASCADE;

View File

@ -83,6 +83,7 @@ select create_distributed_function('mx_call_func_bigint(bigint,bigint)');
select create_distributed_function('mx_call_func_custom_types(mx_call_enum,mx_call_enum)'); select create_distributed_function('mx_call_func_custom_types(mx_call_enum,mx_call_enum)');
select create_distributed_function('squares(int)'); select create_distributed_function('squares(int)');
-- We still don't route them to the workers, because they aren't -- We still don't route them to the workers, because they aren't
-- colocated with any distributed tables. -- colocated with any distributed tables.
SET client_min_messages TO DEBUG1; SET client_min_messages TO DEBUG1;
@ -259,6 +260,14 @@ EXECUTE call_plan(2, 0);
EXECUTE call_plan(2, 0); EXECUTE call_plan(2, 0);
EXECUTE call_plan(2, 0); EXECUTE call_plan(2, 0);
\c - - - :worker_1_port
SET search_path TO multi_mx_function_call_delegation, public;
-- create_distributed_function is disallowed from worker nodes
select create_distributed_function('mx_call_func(int,int)');
\c - - - :master_port
SET search_path TO multi_mx_function_call_delegation, public;
RESET client_min_messages; RESET client_min_messages;
\set VERBOSITY terse \set VERBOSITY terse
DROP SCHEMA multi_mx_function_call_delegation CASCADE; DROP SCHEMA multi_mx_function_call_delegation CASCADE;