mirror of https://github.com/citusdata/citus.git
Set colocationid sequence
parent
421f17235f
commit
6988693e49
|
@ -1,5 +1,6 @@
|
|||
CREATE SCHEMA function_propagation_schema;
|
||||
SET search_path TO 'function_propagation_schema';
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_colocationid_seq RESTART 10000;
|
||||
-- Check whether supported dependencies can be distributed while propagating functions
|
||||
-- Check types
|
||||
SET citus.enable_metadata_sync TO OFF;
|
||||
|
@ -1119,7 +1120,7 @@ SELECT create_distributed_function('func_to_colocate(int)', colocate_with:='tbl_
|
|||
SELECT distribution_argument_index, colocationid, force_delegation FROM pg_catalog.pg_dist_object WHERE objid = 'func_to_colocate'::regproc;
|
||||
distribution_argument_index | colocationid | force_delegation
|
||||
---------------------------------------------------------------------
|
||||
| 163 |
|
||||
| 10001 |
|
||||
(1 row)
|
||||
|
||||
-- convert to non-delegated
|
||||
|
@ -1147,7 +1148,7 @@ SELECT create_distributed_function('func_to_colocate(int)','$1','tbl_to_colocate
|
|||
SELECT distribution_argument_index, colocationid, force_delegation FROM pg_catalog.pg_dist_object WHERE objid = 'func_to_colocate'::regproc;
|
||||
distribution_argument_index | colocationid | force_delegation
|
||||
---------------------------------------------------------------------
|
||||
0 | 164 |
|
||||
0 | 10002 |
|
||||
(1 row)
|
||||
|
||||
-- try create or replace the same func
|
||||
|
@ -1156,7 +1157,7 @@ CREATE OR REPLACE FUNCTION func_to_colocate (a int) returns int as $$select 1;$$
|
|||
SELECT distribution_argument_index, colocationid, force_delegation FROM pg_catalog.pg_dist_object WHERE objid = 'func_to_colocate'::regproc;
|
||||
distribution_argument_index | colocationid | force_delegation
|
||||
---------------------------------------------------------------------
|
||||
0 | 164 |
|
||||
0 | 10002 |
|
||||
(1 row)
|
||||
|
||||
-- convert to non-delegated
|
||||
|
@ -1184,7 +1185,7 @@ SELECT create_distributed_function('func_to_colocate(int)','$1','tbl_to_colocate
|
|||
SELECT distribution_argument_index, colocationid, force_delegation FROM pg_catalog.pg_dist_object WHERE objid = 'func_to_colocate'::regproc;
|
||||
distribution_argument_index | colocationid | force_delegation
|
||||
---------------------------------------------------------------------
|
||||
0 | 164 | t
|
||||
0 | 10002 | t
|
||||
(1 row)
|
||||
|
||||
-- convert to non-delegated
|
||||
|
|
|
@ -8,6 +8,7 @@ SET citus.next_shard_id TO 910000;
|
|||
SET citus.shard_replication_factor TO 1;
|
||||
CREATE SCHEMA fix_idx_names;
|
||||
SET search_path TO fix_idx_names, public;
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_colocationid_seq RESTART 1370000;
|
||||
-- stop metadata sync for one of the worker nodes so we test both cases
|
||||
SELECT stop_metadata_sync_to_node('localhost', :worker_1_port);
|
||||
NOTICE: dropping metadata on the node (localhost,57637)
|
||||
|
@ -678,9 +679,9 @@ NOTICE: issuing SET citus.enable_ddl_propagation TO 'off'
|
|||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing SET citus.enable_ddl_propagation TO 'off'
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing SELECT citus_internal_add_partition_metadata ('fix_idx_names.p2'::regclass, 'h', 'dist_col', 100050, 's')
|
||||
NOTICE: issuing SELECT citus_internal_add_partition_metadata ('fix_idx_names.p2'::regclass, 'h', 'dist_col', 1370000, 's')
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing SELECT citus_internal_add_partition_metadata ('fix_idx_names.p2'::regclass, 'h', 'dist_col', 100050, 's')
|
||||
NOTICE: issuing SELECT citus_internal_add_partition_metadata ('fix_idx_names.p2'::regclass, 'h', 'dist_col', 1370000, 's')
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
NOTICE: issuing WITH shard_data(relationname, shardid, storagetype, shardminvalue, shardmaxvalue) AS (VALUES ('fix_idx_names.p2'::regclass, 915002, 't'::"char", '-2147483648', '2147483647')) SELECT citus_internal_add_shard_metadata(relationname, shardid, storagetype, shardminvalue, shardmaxvalue) FROM shard_data;
|
||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||
|
|
|
@ -19,6 +19,7 @@ NOTICE: dropping metadata on the node (localhost,57638)
|
|||
(1 row)
|
||||
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1310000;
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_colocationid_seq RESTART 2;
|
||||
SET citus.replicate_reference_tables_on_activate TO off;
|
||||
SELECT nextval('pg_catalog.pg_dist_placement_placementid_seq') AS last_placement_id
|
||||
\gset
|
||||
|
|
|
@ -269,13 +269,13 @@ RESET client_min_messages;
|
|||
SELECT logicalrelid, colocationid FROM pg_dist_partition WHERE logicalrelid::regclass::text IN ('test_proc_colocation_0');
|
||||
logicalrelid | colocationid
|
||||
---------------------------------------------------------------------
|
||||
test_proc_colocation_0 | 1410004
|
||||
test_proc_colocation_0 | 1410005
|
||||
(1 row)
|
||||
|
||||
SELECT proname, colocationid FROM pg_proc JOIN pg_catalog.pg_dist_object ON pg_proc.oid = pg_catalog.pg_dist_object.objid WHERE proname IN ('proc_0');
|
||||
proname | colocationid
|
||||
---------------------------------------------------------------------
|
||||
proc_0 | 1410004
|
||||
proc_0 | 1410005
|
||||
(1 row)
|
||||
|
||||
-- shardCount is not null && cascade_to_colocated is true
|
||||
|
@ -302,13 +302,13 @@ RESET client_min_messages;
|
|||
SELECT logicalrelid, colocationid FROM pg_dist_partition WHERE logicalrelid::regclass::text IN ('test_proc_colocation_0');
|
||||
logicalrelid | colocationid
|
||||
---------------------------------------------------------------------
|
||||
test_proc_colocation_0 | 1410003
|
||||
test_proc_colocation_0 | 1410006
|
||||
(1 row)
|
||||
|
||||
SELECT proname, colocationid FROM pg_proc JOIN pg_catalog.pg_dist_object ON pg_proc.oid = pg_catalog.pg_dist_object.objid WHERE proname IN ('proc_0');
|
||||
proname | colocationid
|
||||
---------------------------------------------------------------------
|
||||
proc_0 | 1410003
|
||||
proc_0 | 1410006
|
||||
(1 row)
|
||||
|
||||
-- colocatewith is not null && cascade_to_colocated is true
|
||||
|
@ -356,13 +356,13 @@ RESET client_min_messages;
|
|||
SELECT logicalrelid, colocationid FROM pg_dist_partition WHERE logicalrelid::regclass::text IN ('test_proc_colocation_0');
|
||||
logicalrelid | colocationid
|
||||
---------------------------------------------------------------------
|
||||
test_proc_colocation_0 | 1410005
|
||||
test_proc_colocation_0 | 1410008
|
||||
(1 row)
|
||||
|
||||
SELECT proname, colocationid FROM pg_proc JOIN pg_catalog.pg_dist_object ON pg_proc.oid = pg_catalog.pg_dist_object.objid WHERE proname IN ('proc_0');
|
||||
proname | colocationid
|
||||
---------------------------------------------------------------------
|
||||
proc_0 | 1410005
|
||||
proc_0 | 1410008
|
||||
(1 row)
|
||||
|
||||
-- try a case with more than one procedure
|
||||
|
@ -386,14 +386,14 @@ SELECT create_distributed_function('proc_1(float8)', 'dist_key', 'test_proc_colo
|
|||
SELECT logicalrelid, colocationid FROM pg_dist_partition WHERE logicalrelid::regclass::text IN ('test_proc_colocation_0');
|
||||
logicalrelid | colocationid
|
||||
---------------------------------------------------------------------
|
||||
test_proc_colocation_0 | 1410005
|
||||
test_proc_colocation_0 | 1410008
|
||||
(1 row)
|
||||
|
||||
SELECT proname, colocationid FROM pg_proc JOIN pg_catalog.pg_dist_object ON pg_proc.oid = pg_catalog.pg_dist_object.objid WHERE proname IN ('proc_0', 'proc_1') ORDER BY proname;
|
||||
proname | colocationid
|
||||
---------------------------------------------------------------------
|
||||
proc_0 | 1410005
|
||||
proc_1 | 1410005
|
||||
proc_0 | 1410008
|
||||
proc_1 | 1410008
|
||||
(2 rows)
|
||||
|
||||
SET client_min_messages TO DEBUG1;
|
||||
|
@ -437,14 +437,14 @@ RESET client_min_messages;
|
|||
SELECT logicalrelid, colocationid FROM pg_dist_partition WHERE logicalrelid::regclass::text IN ('test_proc_colocation_0');
|
||||
logicalrelid | colocationid
|
||||
---------------------------------------------------------------------
|
||||
test_proc_colocation_0 | 1410003
|
||||
test_proc_colocation_0 | 1410009
|
||||
(1 row)
|
||||
|
||||
SELECT proname, colocationid FROM pg_proc JOIN pg_catalog.pg_dist_object ON pg_proc.oid = pg_catalog.pg_dist_object.objid WHERE proname IN ('proc_0', 'proc_1') ORDER BY proname;
|
||||
proname | colocationid
|
||||
---------------------------------------------------------------------
|
||||
proc_0 | 1410003
|
||||
proc_1 | 1410003
|
||||
proc_0 | 1410009
|
||||
proc_1 | 1410009
|
||||
(2 rows)
|
||||
|
||||
-- case which shouldn't preserve colocation for now
|
||||
|
@ -462,14 +462,14 @@ NOTICE: renaming the new table to mx_alter_distributed_table.test_proc_colocati
|
|||
SELECT logicalrelid, colocationid FROM pg_dist_partition WHERE logicalrelid::regclass::text IN ('test_proc_colocation_0');
|
||||
logicalrelid | colocationid
|
||||
---------------------------------------------------------------------
|
||||
test_proc_colocation_0 | 1410006
|
||||
test_proc_colocation_0 | 1410010
|
||||
(1 row)
|
||||
|
||||
SELECT proname, colocationid FROM pg_proc JOIN pg_catalog.pg_dist_object ON pg_proc.oid = pg_catalog.pg_dist_object.objid WHERE proname IN ('proc_0', 'proc_1') ORDER BY proname;
|
||||
proname | colocationid
|
||||
---------------------------------------------------------------------
|
||||
proc_0 | 1410003
|
||||
proc_1 | 1410003
|
||||
proc_0 | 1410009
|
||||
proc_1 | 1410009
|
||||
(2 rows)
|
||||
|
||||
SET client_min_messages TO WARNING;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
-- MULTI_MX_CREATE_TABLE
|
||||
--
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1220000;
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_colocationid_seq RESTART 1220000;
|
||||
SELECT start_metadata_sync_to_node('localhost', :worker_1_port);
|
||||
start_metadata_sync_to_node
|
||||
---------------------------------------------------------------------
|
||||
|
@ -406,29 +407,29 @@ FROM pg_dist_partition NATURAL JOIN shard_counts
|
|||
ORDER BY colocationid, logicalrelid;
|
||||
logicalrelid | colocationid | shard_count | partmethod | repmodel
|
||||
---------------------------------------------------------------------
|
||||
customer_mx | 1390001 | 1 | n | t
|
||||
nation_mx | 1390001 | 1 | n | t
|
||||
part_mx | 1390001 | 1 | n | t
|
||||
supplier_mx | 1390001 | 1 | n | t
|
||||
citus_mx_test_schema_join_1.nation_hash | 1390003 | 4 | h | s
|
||||
citus_mx_test_schema_join_1.nation_hash_2 | 1390003 | 4 | h | s
|
||||
citus_mx_test_schema_join_2.nation_hash | 1390003 | 4 | h | s
|
||||
citus_mx_test_schema.nation_hash_collation_search_path | 1390003 | 4 | h | s
|
||||
citus_mx_test_schema.nation_hash_composite_types | 1390003 | 4 | h | s
|
||||
mx_ddl_table | 1390003 | 4 | h | s
|
||||
app_analytics_events_mx | 1390003 | 4 | h | s
|
||||
company_employees_mx | 1390003 | 4 | h | s
|
||||
nation_hash | 1390006 | 16 | h | s
|
||||
citus_mx_test_schema.nation_hash | 1390006 | 16 | h | s
|
||||
lineitem_mx | 1390007 | 16 | h | s
|
||||
orders_mx | 1390007 | 16 | h | s
|
||||
limit_orders_mx | 1390008 | 2 | h | s
|
||||
articles_hash_mx | 1390008 | 2 | h | s
|
||||
multiple_hash_mx | 1390009 | 2 | h | s
|
||||
researchers_mx | 1390010 | 2 | h | s
|
||||
labs_mx | 1390011 | 1 | h | s
|
||||
objects_mx | 1390011 | 1 | h | s
|
||||
articles_single_shard_hash_mx | 1390011 | 1 | h | s
|
||||
nation_hash | 1220000 | 16 | h | s
|
||||
citus_mx_test_schema.nation_hash | 1220000 | 16 | h | s
|
||||
customer_mx | 1220001 | 1 | n | t
|
||||
nation_mx | 1220001 | 1 | n | t
|
||||
part_mx | 1220001 | 1 | n | t
|
||||
supplier_mx | 1220001 | 1 | n | t
|
||||
citus_mx_test_schema_join_1.nation_hash | 1220002 | 4 | h | s
|
||||
citus_mx_test_schema_join_1.nation_hash_2 | 1220002 | 4 | h | s
|
||||
citus_mx_test_schema_join_2.nation_hash | 1220002 | 4 | h | s
|
||||
citus_mx_test_schema.nation_hash_collation_search_path | 1220002 | 4 | h | s
|
||||
citus_mx_test_schema.nation_hash_composite_types | 1220002 | 4 | h | s
|
||||
mx_ddl_table | 1220002 | 4 | h | s
|
||||
app_analytics_events_mx | 1220002 | 4 | h | s
|
||||
company_employees_mx | 1220002 | 4 | h | s
|
||||
lineitem_mx | 1220003 | 16 | h | s
|
||||
orders_mx | 1220003 | 16 | h | s
|
||||
limit_orders_mx | 1220004 | 2 | h | s
|
||||
articles_hash_mx | 1220004 | 2 | h | s
|
||||
multiple_hash_mx | 1220005 | 2 | h | s
|
||||
researchers_mx | 1220006 | 2 | h | s
|
||||
labs_mx | 1220007 | 1 | h | s
|
||||
objects_mx | 1220007 | 1 | h | s
|
||||
articles_single_shard_hash_mx | 1220007 | 1 | h | s
|
||||
(23 rows)
|
||||
|
||||
-- check the citus_tables view
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
CREATE SCHEMA start_stop_metadata_sync;
|
||||
SET search_path TO "start_stop_metadata_sync";
|
||||
SET citus.next_shard_id TO 980000;
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_colocationid_seq RESTART 980000;
|
||||
SET client_min_messages TO WARNING;
|
||||
SET citus.shard_count TO 4;
|
||||
SET citus.shard_replication_factor TO 1;
|
||||
|
@ -158,12 +159,12 @@ SELECT * FROM test_matview;
|
|||
SELECT * FROM pg_dist_partition WHERE logicalrelid::text LIKE 'events%' ORDER BY logicalrelid::text;
|
||||
logicalrelid | partmethod | partkey | colocationid | repmodel | autoconverted
|
||||
---------------------------------------------------------------------
|
||||
events | h | {VAR :varno 1 :varattno 1 :vartype 1184 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 1 :varoattno 1 :location -1} | 1390012 | s | f
|
||||
events_2021_feb | h | {VAR :varno 1 :varattno 1 :vartype 1184 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 1 :varoattno 1 :location -1} | 1390012 | s | f
|
||||
events_2021_jan | h | {VAR :varno 1 :varattno 1 :vartype 1184 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 1 :varoattno 1 :location -1} | 1390012 | s | f
|
||||
events_replicated | h | {VAR :varno 1 :varattno 1 :vartype 1184 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 1 :varoattno 1 :location -1} | 1390013 | c | f
|
||||
events_replicated_2021_feb | h | {VAR :varno 1 :varattno 1 :vartype 1184 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 1 :varoattno 1 :location -1} | 1390013 | c | f
|
||||
events_replicated_2021_jan | h | {VAR :varno 1 :varattno 1 :vartype 1184 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 1 :varoattno 1 :location -1} | 1390013 | c | f
|
||||
events | h | {VAR :varno 1 :varattno 1 :vartype 1184 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 1 :varoattno 1 :location -1} | 980000 | s | f
|
||||
events_2021_feb | h | {VAR :varno 1 :varattno 1 :vartype 1184 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 1 :varoattno 1 :location -1} | 980000 | s | f
|
||||
events_2021_jan | h | {VAR :varno 1 :varattno 1 :vartype 1184 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 1 :varoattno 1 :location -1} | 980000 | s | f
|
||||
events_replicated | h | {VAR :varno 1 :varattno 1 :vartype 1184 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 1 :varoattno 1 :location -1} | 980001 | c | f
|
||||
events_replicated_2021_feb | h | {VAR :varno 1 :varattno 1 :vartype 1184 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 1 :varoattno 1 :location -1} | 980001 | c | f
|
||||
events_replicated_2021_jan | h | {VAR :varno 1 :varattno 1 :vartype 1184 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 1 :varoattno 1 :location -1} | 980001 | c | f
|
||||
(6 rows)
|
||||
|
||||
SELECT count(*) > 0 FROM pg_dist_node;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
CREATE SCHEMA function_propagation_schema;
|
||||
SET search_path TO 'function_propagation_schema';
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_colocationid_seq RESTART 10000;
|
||||
|
||||
-- Check whether supported dependencies can be distributed while propagating functions
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@ SET citus.shard_replication_factor TO 1;
|
|||
CREATE SCHEMA fix_idx_names;
|
||||
SET search_path TO fix_idx_names, public;
|
||||
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_colocationid_seq RESTART 1370000;
|
||||
|
||||
-- stop metadata sync for one of the worker nodes so we test both cases
|
||||
SELECT stop_metadata_sync_to_node('localhost', :worker_1_port);
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ SELECT stop_metadata_sync_to_node('localhost', :worker_1_port);
|
|||
SELECT stop_metadata_sync_to_node('localhost', :worker_2_port);
|
||||
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1310000;
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_colocationid_seq RESTART 2;
|
||||
SET citus.replicate_reference_tables_on_activate TO off;
|
||||
|
||||
SELECT nextval('pg_catalog.pg_dist_placement_placementid_seq') AS last_placement_id
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
--
|
||||
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1220000;
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_colocationid_seq RESTART 1220000;
|
||||
|
||||
SELECT start_metadata_sync_to_node('localhost', :worker_1_port);
|
||||
SELECT start_metadata_sync_to_node('localhost', :worker_2_port);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
CREATE SCHEMA start_stop_metadata_sync;
|
||||
SET search_path TO "start_stop_metadata_sync";
|
||||
SET citus.next_shard_id TO 980000;
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_colocationid_seq RESTART 980000;
|
||||
SET client_min_messages TO WARNING;
|
||||
SET citus.shard_count TO 4;
|
||||
SET citus.shard_replication_factor TO 1;
|
||||
|
|
Loading…
Reference in New Issue