Remove unused UDF mark_tables_colocated

pull/4529/head
Ahmet Gedemenli 2021-01-18 12:25:54 +03:00
parent 64a1fddd9a
commit ceb6b503c0
14 changed files with 49 additions and 8 deletions

View File

@ -63,6 +63,7 @@ RENAME TO citus_drop_all_shards;
DROP FUNCTION pg_catalog.master_modify_multiple_shards(text); DROP FUNCTION pg_catalog.master_modify_multiple_shards(text);
DROP FUNCTION pg_catalog.master_create_distributed_table(regclass, text, citus.distribution_type); DROP FUNCTION pg_catalog.master_create_distributed_table(regclass, text, citus.distribution_type);
DROP FUNCTION pg_catalog.master_create_worker_shards(text, integer, integer); DROP FUNCTION pg_catalog.master_create_worker_shards(text, integer, integer);
DROP FUNCTION pg_catalog.mark_tables_colocated(regclass, regclass[]);
#include "udfs/citus_shard_sizes/10.0-1.sql" #include "udfs/citus_shard_sizes/10.0-1.sql"
#include "udfs/citus_shards/10.0-1.sql" #include "udfs/citus_shards/10.0-1.sql"

View File

@ -58,6 +58,13 @@ DROP PROCEDURE pg_catalog.alter_old_partitions_set_access_method(regclass,timest
DROP FUNCTION pg_catalog.citus_set_coordinator_host(text,int,noderole,name); DROP FUNCTION pg_catalog.citus_set_coordinator_host(text,int,noderole,name);
DROP FUNCTION pg_catalog.worker_change_sequence_dependency(regclass, regclass, regclass); DROP FUNCTION pg_catalog.worker_change_sequence_dependency(regclass, regclass, regclass);
CREATE FUNCTION pg_catalog.mark_tables_colocated(source_table_name regclass, target_table_names regclass[])
RETURNS void
LANGUAGE C STRICT
AS 'MODULE_PATHNAME', $$mark_tables_colocated$$;
COMMENT ON FUNCTION pg_catalog.mark_tables_colocated(source_table_name regclass, target_table_names regclass[])
IS 'mark target distributed tables as colocated with the source table';
CREATE FUNCTION pg_catalog.master_modify_multiple_shards(text) CREATE FUNCTION pg_catalog.master_modify_multiple_shards(text)
RETURNS integer RETURNS integer
LANGUAGE C STRICT LANGUAGE C STRICT

View File

@ -15,7 +15,8 @@ SELECT create_distributed_table('testtableddl', 'distributecol', 'append');
-- change this test every time the previous tests change the set of tables they leave -- change this test every time the previous tests change the set of tables they leave
-- around. -- around.
SET client_min_messages TO 'WARNING'; SET client_min_messages TO 'WARNING';
DROP FUNCTION pg_catalog.master_create_worker_shards; DROP FUNCTION pg_catalog.master_create_worker_shards(text, integer, integer);
DROP FUNCTION pg_catalog.mark_tables_colocated(regclass, regclass[]);
DROP EXTENSION citus CASCADE; DROP EXTENSION citus CASCADE;
RESET client_min_messages; RESET client_min_messages;
BEGIN; BEGIN;

View File

@ -447,6 +447,7 @@ SELECT * FROM print_extension_changes();
--------------------------------------------------------------------- ---------------------------------------------------------------------
function citus_total_relation_size(regclass) | function citus_total_relation_size(regclass) |
function create_citus_local_table(regclass) | function create_citus_local_table(regclass) |
function mark_tables_colocated(regclass, regclass[]) |
function master_conninfo_cache_invalidate() | function master_conninfo_cache_invalidate() |
function master_create_distributed_table(regclass,text,citus.distribution_type) | function master_create_distributed_table(regclass,text,citus.distribution_type) |
function master_create_worker_shards(text,integer,integer) | function master_create_worker_shards(text,integer,integer) |
@ -505,7 +506,7 @@ SELECT * FROM print_extension_changes();
| view citus_shards | view citus_shards
| view citus_tables | view citus_tables
| view time_partitions | view time_partitions
(60 rows) (61 rows)
DROP TABLE prev_objects, extension_diff; DROP TABLE prev_objects, extension_diff;
-- show running version -- show running version

View File

@ -447,6 +447,7 @@ SELECT * FROM print_extension_changes();
--------------------------------------------------------------------- ---------------------------------------------------------------------
function citus_total_relation_size(regclass) | function citus_total_relation_size(regclass) |
function create_citus_local_table(regclass) | function create_citus_local_table(regclass) |
function mark_tables_colocated(regclass, regclass[]) |
function master_conninfo_cache_invalidate() | function master_conninfo_cache_invalidate() |
function master_create_distributed_table(regclass,text,citus.distribution_type) | function master_create_distributed_table(regclass,text,citus.distribution_type) |
function master_create_worker_shards(text,integer,integer) | function master_create_worker_shards(text,integer,integer) |
@ -501,7 +502,7 @@ SELECT * FROM print_extension_changes();
| view citus_shards | view citus_shards
| view citus_tables | view citus_tables
| view time_partitions | view time_partitions
(56 rows) (57 rows)
DROP TABLE prev_objects, extension_diff; DROP TABLE prev_objects, extension_diff;
-- show running version -- show running version

View File

@ -810,6 +810,11 @@ SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='mx_test_schema_1
-- Check that mark_tables_colocated call propagates the changes to the workers -- Check that mark_tables_colocated call propagates the changes to the workers
\c - - - :master_port \c - - - :master_port
-- this function is dropped in Citus10, added here for tests
CREATE OR REPLACE FUNCTION pg_catalog.mark_tables_colocated(source_table_name regclass, target_table_names regclass[])
RETURNS void
LANGUAGE C STRICT
AS 'citus', $$mark_tables_colocated$$;
SELECT nextval('pg_catalog.pg_dist_colocationid_seq') AS last_colocation_id \gset SELECT nextval('pg_catalog.pg_dist_colocationid_seq') AS last_colocation_id \gset
ALTER SEQUENCE pg_catalog.pg_dist_colocationid_seq RESTART 10000; ALTER SEQUENCE pg_catalog.pg_dist_colocationid_seq RESTART 10000;
SET citus.shard_count TO 7; SET citus.shard_count TO 7;

View File

@ -1196,6 +1196,11 @@ DEBUG: cannot perform distributed INSERT INTO ... SELECT because the partition
DETAIL: The target table's partition column should correspond to a partition column in the subquery. DETAIL: The target table's partition column should correspond to a partition column in the subquery.
DEBUG: performing repartitioned INSERT ... SELECT DEBUG: performing repartitioned INSERT ... SELECT
RESET client_min_messages; RESET client_min_messages;
-- this function is dropped in Citus10, added here for tests
CREATE OR REPLACE FUNCTION pg_catalog.mark_tables_colocated(source_table_name regclass, target_table_names regclass[])
RETURNS void
LANGUAGE C STRICT
AS 'citus', $$mark_tables_colocated$$;
-- some tests for mark_tables_colocated -- some tests for mark_tables_colocated
-- should error out -- should error out
SELECT mark_tables_colocated('colocated_table_test_2', ARRAY['reference_table_test']); SELECT mark_tables_colocated('colocated_table_test_2', ARRAY['reference_table_test']);

View File

@ -221,6 +221,11 @@ SELECT master_remove_node('localhost', 5432);
\c - - - :worker_1_port \c - - - :worker_1_port
-- mark_tables_colocated -- mark_tables_colocated
-- this function is dropped in Citus10, added here for tests
CREATE OR REPLACE FUNCTION pg_catalog.mark_tables_colocated(source_table_name regclass, target_table_names regclass[])
RETURNS void
LANGUAGE C STRICT
AS 'citus', $$mark_tables_colocated$$;
UPDATE pg_dist_partition SET colocationid = 0 WHERE logicalrelid='mx_table_2'::regclass; UPDATE pg_dist_partition SET colocationid = 0 WHERE logicalrelid='mx_table_2'::regclass;
SELECT mark_tables_colocated('mx_table', ARRAY['mx_table_2']); SELECT mark_tables_colocated('mx_table', ARRAY['mx_table_2']);
ERROR: operation is not allowed on this node ERROR: operation is not allowed on this node

View File

@ -126,7 +126,6 @@ ORDER BY 1;
function lock_relation_if_exists(text,text) function lock_relation_if_exists(text,text)
function lock_shard_metadata(integer,bigint[]) function lock_shard_metadata(integer,bigint[])
function lock_shard_resources(integer,bigint[]) function lock_shard_resources(integer,bigint[])
function mark_tables_colocated(regclass,regclass[])
function master_activate_node(text,integer) function master_activate_node(text,integer)
function master_add_inactive_node(text,integer,integer,noderole,name) function master_add_inactive_node(text,integer,integer,noderole,name)
function master_add_node(text,integer,integer,noderole,name) function master_add_node(text,integer,integer,noderole,name)
@ -237,5 +236,5 @@ ORDER BY 1;
view citus_worker_stat_activity view citus_worker_stat_activity
view pg_dist_shard_placement view pg_dist_shard_placement
view time_partitions view time_partitions
(221 rows) (220 rows)

View File

@ -122,7 +122,6 @@ ORDER BY 1;
function lock_relation_if_exists(text,text) function lock_relation_if_exists(text,text)
function lock_shard_metadata(integer,bigint[]) function lock_shard_metadata(integer,bigint[])
function lock_shard_resources(integer,bigint[]) function lock_shard_resources(integer,bigint[])
function mark_tables_colocated(regclass,regclass[])
function master_activate_node(text,integer) function master_activate_node(text,integer)
function master_add_inactive_node(text,integer,integer,noderole,name) function master_add_inactive_node(text,integer,integer,noderole,name)
function master_add_node(text,integer,integer,noderole,name) function master_add_node(text,integer,integer,noderole,name)
@ -233,5 +232,5 @@ ORDER BY 1;
view citus_worker_stat_activity view citus_worker_stat_activity
view pg_dist_shard_placement view pg_dist_shard_placement
view time_partitions view time_partitions
(217 rows) (216 rows)

View File

@ -15,7 +15,8 @@ SELECT create_distributed_table('testtableddl', 'distributecol', 'append');
-- change this test every time the previous tests change the set of tables they leave -- change this test every time the previous tests change the set of tables they leave
-- around. -- around.
SET client_min_messages TO 'WARNING'; SET client_min_messages TO 'WARNING';
DROP FUNCTION pg_catalog.master_create_worker_shards; DROP FUNCTION pg_catalog.master_create_worker_shards(text, integer, integer);
DROP FUNCTION pg_catalog.mark_tables_colocated(regclass, regclass[]);
DROP EXTENSION citus CASCADE; DROP EXTENSION citus CASCADE;
RESET client_min_messages; RESET client_min_messages;

View File

@ -356,6 +356,11 @@ SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='mx_test_schema_1
-- Check that mark_tables_colocated call propagates the changes to the workers -- Check that mark_tables_colocated call propagates the changes to the workers
\c - - - :master_port \c - - - :master_port
-- this function is dropped in Citus10, added here for tests
CREATE OR REPLACE FUNCTION pg_catalog.mark_tables_colocated(source_table_name regclass, target_table_names regclass[])
RETURNS void
LANGUAGE C STRICT
AS 'citus', $$mark_tables_colocated$$;
SELECT nextval('pg_catalog.pg_dist_colocationid_seq') AS last_colocation_id \gset SELECT nextval('pg_catalog.pg_dist_colocationid_seq') AS last_colocation_id \gset
ALTER SEQUENCE pg_catalog.pg_dist_colocationid_seq RESTART 10000; ALTER SEQUENCE pg_catalog.pg_dist_colocationid_seq RESTART 10000;
SET citus.shard_count TO 7; SET citus.shard_count TO 7;

View File

@ -764,6 +764,12 @@ WHERE
RESET client_min_messages; RESET client_min_messages;
-- this function is dropped in Citus10, added here for tests
CREATE OR REPLACE FUNCTION pg_catalog.mark_tables_colocated(source_table_name regclass, target_table_names regclass[])
RETURNS void
LANGUAGE C STRICT
AS 'citus', $$mark_tables_colocated$$;
-- some tests for mark_tables_colocated -- some tests for mark_tables_colocated
-- should error out -- should error out
SELECT mark_tables_colocated('colocated_table_test_2', ARRAY['reference_table_test']); SELECT mark_tables_colocated('colocated_table_test_2', ARRAY['reference_table_test']);

View File

@ -143,6 +143,11 @@ SELECT master_remove_node('localhost', 5432);
\c - - - :worker_1_port \c - - - :worker_1_port
-- mark_tables_colocated -- mark_tables_colocated
-- this function is dropped in Citus10, added here for tests
CREATE OR REPLACE FUNCTION pg_catalog.mark_tables_colocated(source_table_name regclass, target_table_names regclass[])
RETURNS void
LANGUAGE C STRICT
AS 'citus', $$mark_tables_colocated$$;
UPDATE pg_dist_partition SET colocationid = 0 WHERE logicalrelid='mx_table_2'::regclass; UPDATE pg_dist_partition SET colocationid = 0 WHERE logicalrelid='mx_table_2'::regclass;
SELECT mark_tables_colocated('mx_table', ARRAY['mx_table_2']); SELECT mark_tables_colocated('mx_table', ARRAY['mx_table_2']);