make config

pull/7572/head
Vinod Sridharan 2024-04-04 01:06:26 +00:00
parent 45804c0e5d
commit 80c982176e
4 changed files with 67 additions and 10 deletions

View File

@ -468,7 +468,7 @@ DROP TABLE temp_table;
DROP TABLE shard_count_table_3; DROP TABLE shard_count_table_3;
-- test shard count 1 placement with colocate none. -- test shard count 1 placement with colocate none.
-- create a base table instance -- create a base table instance
set citus.enable_single_hash_repartition_joins to on; set citus.enable_single_shard_table_multi_node_placement to on;
CREATE TABLE shard_count_table_1_inst_1 (a int); CREATE TABLE shard_count_table_1_inst_1 (a int);
SELECT create_distributed_table('shard_count_table_1_inst_1', 'a', shard_count:=1, colocate_with:='none'); SELECT create_distributed_table('shard_count_table_1_inst_1', 'a', shard_count:=1, colocate_with:='none');
create_distributed_table create_distributed_table
@ -507,10 +507,10 @@ SELECT shard_count = 1 FROM citus_tables WHERE table_name = 'shard_count_table_1
-- check placement: These should be placed on different workers. -- check placement: These should be placed on different workers.
SELECT nodename || ':' || nodeport AS inst_1_node_endpoint FROM citus_shards WHERE table_name = 'shard_count_table_1_inst_1'::regclass \gset SELECT nodename || ':' || nodeport AS inst_1_node_endpoint FROM citus_shards WHERE table_name = 'shard_count_table_1_inst_1'::regclass \gset
SELECT nodename || ':' || nodeport AS inst_2_node_endpoint FROM citus_shards WHERE table_name = 'shard_count_table_1_inst_2'::regclass \gset SELECT nodename || ':' || nodeport AS inst_2_node_endpoint FROM citus_shards WHERE table_name = 'shard_count_table_1_inst_2'::regclass \gset
SELECT :'inst_1_node_endpoint' = :'inst_2_node_endpoint'; SELECT :'inst_1_node_endpoint', :'inst_2_node_endpoint', :'inst_1_node_endpoint' = :'inst_2_node_endpoint';
?column? ?column? | ?column? | ?column?
--------------------------------------------------------------------- ---------------------------------------------------------------------
f localhost:xxxxx | localhost:xxxxx | f
(1 row) (1 row)
DROP TABLE shard_count_table_1_inst_1; DROP TABLE shard_count_table_1_inst_1;

View File

@ -416,6 +416,23 @@ SELECT create_distributed_table('company_employees_mx', 'company_id');
(1 row) (1 row)
CREATE TABLE articles_single_shard_hash_mx_partition_inst1 (LIKE articles_single_shard_hash_mx);
CREATE TABLE articles_single_shard_hash_mx_partition_inst2 (LIKE articles_single_shard_hash_mx);
SET citus.shard_count TO 1;
SET citus.enable_single_shard_table_multi_node_placement to on;
SELECT create_distributed_table('articles_single_shard_hash_mx_partition_inst1', 'author_id', colocate_with => 'none');
create_distributed_table
---------------------------------------------------------------------
(1 row)
SELECT create_distributed_table('articles_single_shard_hash_mx_partition_inst2', 'author_id', colocate_with => 'none');
create_distributed_table
---------------------------------------------------------------------
(1 row)
set citus.enable_single_shard_table_multi_node_placement to off;
WITH shard_counts AS ( WITH shard_counts AS (
SELECT logicalrelid, count(*) AS shard_count FROM pg_dist_shard GROUP BY logicalrelid SELECT logicalrelid, count(*) AS shard_count FROM pg_dist_shard GROUP BY logicalrelid
) )
@ -447,7 +464,9 @@ ORDER BY colocationid, logicalrelid;
labs_mx | 1220007 | 1 | h | s labs_mx | 1220007 | 1 | h | s
objects_mx | 1220007 | 1 | h | s objects_mx | 1220007 | 1 | h | s
articles_single_shard_hash_mx | 1220007 | 1 | h | s articles_single_shard_hash_mx | 1220007 | 1 | h | s
(23 rows) articles_single_shard_hash_mx_partition_inst1 | 1220008 | 1 | h | s
articles_single_shard_hash_mx_partition_inst2 | 1220009 | 1 | h | s
(25 rows)
-- check the citus_tables view -- check the citus_tables view
SELECT table_name, citus_table_type, distribution_column, shard_count, table_owner SELECT table_name, citus_table_type, distribution_column, shard_count, table_owner
@ -458,6 +477,8 @@ ORDER BY table_name::text;
app_analytics_events_mx | distributed | app_id | 4 | postgres app_analytics_events_mx | distributed | app_id | 4 | postgres
articles_hash_mx | distributed | author_id | 2 | postgres articles_hash_mx | distributed | author_id | 2 | postgres
articles_single_shard_hash_mx | distributed | author_id | 1 | postgres articles_single_shard_hash_mx | distributed | author_id | 1 | postgres
articles_single_shard_hash_mx_partition_inst1 | distributed | author_id | 1 | postgres
articles_single_shard_hash_mx_partition_inst2 | distributed | author_id | 1 | postgres
citus_mx_test_schema.nation_hash | distributed | n_nationkey | 16 | postgres citus_mx_test_schema.nation_hash | distributed | n_nationkey | 16 | postgres
citus_mx_test_schema.nation_hash_collation_search_path | distributed | n_nationkey | 4 | postgres citus_mx_test_schema.nation_hash_collation_search_path | distributed | n_nationkey | 4 | postgres
citus_mx_test_schema.nation_hash_composite_types | distributed | n_nationkey | 4 | postgres citus_mx_test_schema.nation_hash_composite_types | distributed | n_nationkey | 4 | postgres
@ -478,7 +499,7 @@ ORDER BY table_name::text;
part_mx | reference | <none> | 1 | postgres part_mx | reference | <none> | 1 | postgres
researchers_mx | distributed | lab_id | 2 | postgres researchers_mx | distributed | lab_id | 2 | postgres
supplier_mx | reference | <none> | 1 | postgres supplier_mx | reference | <none> | 1 | postgres
(23 rows) (25 rows)
\c - - - :worker_1_port \c - - - :worker_1_port
SET client_min_messages TO WARNING; SET client_min_messages TO WARNING;
@ -490,6 +511,8 @@ ORDER BY table_name::text;
app_analytics_events_mx | distributed | app_id | 4 | postgres app_analytics_events_mx | distributed | app_id | 4 | postgres
articles_hash_mx | distributed | author_id | 2 | postgres articles_hash_mx | distributed | author_id | 2 | postgres
articles_single_shard_hash_mx | distributed | author_id | 1 | postgres articles_single_shard_hash_mx | distributed | author_id | 1 | postgres
articles_single_shard_hash_mx_partition_inst1 | distributed | author_id | 1 | postgres
articles_single_shard_hash_mx_partition_inst2 | distributed | author_id | 1 | postgres
citus_mx_test_schema.nation_hash | distributed | n_nationkey | 16 | postgres citus_mx_test_schema.nation_hash | distributed | n_nationkey | 16 | postgres
citus_mx_test_schema.nation_hash_collation_search_path | distributed | n_nationkey | 4 | postgres citus_mx_test_schema.nation_hash_collation_search_path | distributed | n_nationkey | 4 | postgres
citus_mx_test_schema.nation_hash_composite_types | distributed | n_nationkey | 4 | postgres citus_mx_test_schema.nation_hash_composite_types | distributed | n_nationkey | 4 | postgres
@ -510,7 +533,7 @@ ORDER BY table_name::text;
part_mx | reference | <none> | 1 | postgres part_mx | reference | <none> | 1 | postgres
researchers_mx | distributed | lab_id | 2 | postgres researchers_mx | distributed | lab_id | 2 | postgres
supplier_mx | reference | <none> | 1 | postgres supplier_mx | reference | <none> | 1 | postgres
(23 rows) (25 rows)
SELECT shard_name, table_name, citus_table_type, shard_size FROM citus_shards ORDER BY shard_name::text; SELECT shard_name, table_name, citus_table_type, shard_size FROM citus_shards ORDER BY shard_name::text;
shard_name | table_name | citus_table_type | shard_size shard_name | table_name | citus_table_type | shard_size
@ -540,6 +563,20 @@ SELECT shard_name, table_name, citus_table_type, shard_size FROM citus_shards OR
articles_hash_mx_1220104 | articles_hash_mx | distributed | 0 articles_hash_mx_1220104 | articles_hash_mx | distributed | 0
articles_hash_mx_1220105 | articles_hash_mx | distributed | 0 articles_hash_mx_1220105 | articles_hash_mx | distributed | 0
articles_single_shard_hash_mx_1220106 | articles_single_shard_hash_mx | distributed | 0 articles_single_shard_hash_mx_1220106 | articles_single_shard_hash_mx | distributed | 0
articles_single_shard_hash_mx_1220106 | articles_single_shard_hash_mx | distributed | 0
articles_single_shard_hash_mx_1220106 | articles_single_shard_hash_mx | distributed | 0
articles_single_shard_hash_mx_1220106 | articles_single_shard_hash_mx | distributed | 0
articles_single_shard_hash_mx_1220106 | articles_single_shard_hash_mx | distributed | 0
articles_single_shard_hash_mx_1220106 | articles_single_shard_hash_mx | distributed | 0
articles_single_shard_hash_mx_1220106 | articles_single_shard_hash_mx | distributed | 0
articles_single_shard_hash_mx_partition_inst1_1220111 | articles_single_shard_hash_mx_partition_inst1 | distributed | 0
articles_single_shard_hash_mx_partition_inst1_1220111 | articles_single_shard_hash_mx_partition_inst1 | distributed | 0
articles_single_shard_hash_mx_partition_inst1_1220111 | articles_single_shard_hash_mx_partition_inst1 | distributed | 0
articles_single_shard_hash_mx_partition_inst1_1220111 | articles_single_shard_hash_mx_partition_inst1 | distributed | 0
articles_single_shard_hash_mx_partition_inst1_1220111 | articles_single_shard_hash_mx_partition_inst1 | distributed | 0
articles_single_shard_hash_mx_partition_inst1_1220111 | articles_single_shard_hash_mx_partition_inst1 | distributed | 0
articles_single_shard_hash_mx_partition_inst1_1220111 | articles_single_shard_hash_mx_partition_inst1 | distributed | 0
articles_single_shard_hash_mx_partition_inst2_1220112 | articles_single_shard_hash_mx_partition_inst2 | distributed | 0
citus_mx_test_schema.nation_hash_1220016 | citus_mx_test_schema.nation_hash | distributed | 0 citus_mx_test_schema.nation_hash_1220016 | citus_mx_test_schema.nation_hash | distributed | 0
citus_mx_test_schema.nation_hash_1220016 | citus_mx_test_schema.nation_hash | distributed | 0 citus_mx_test_schema.nation_hash_1220016 | citus_mx_test_schema.nation_hash | distributed | 0
citus_mx_test_schema.nation_hash_1220016 | citus_mx_test_schema.nation_hash | distributed | 0 citus_mx_test_schema.nation_hash_1220016 | citus_mx_test_schema.nation_hash | distributed | 0
@ -709,6 +746,12 @@ SELECT shard_name, table_name, citus_table_type, shard_size FROM citus_shards OR
customer_mx_1220084 | customer_mx | reference | 0 customer_mx_1220084 | customer_mx | reference | 0
customer_mx_1220084 | customer_mx | reference | 0 customer_mx_1220084 | customer_mx | reference | 0
labs_mx_1220102 | labs_mx | distributed | 8192 labs_mx_1220102 | labs_mx | distributed | 8192
labs_mx_1220102 | labs_mx | distributed | 8192
labs_mx_1220102 | labs_mx | distributed | 8192
labs_mx_1220102 | labs_mx | distributed | 8192
labs_mx_1220102 | labs_mx | distributed | 8192
labs_mx_1220102 | labs_mx | distributed | 8192
labs_mx_1220102 | labs_mx | distributed | 8192
limit_orders_mx_1220092 | limit_orders_mx | distributed | 16384 limit_orders_mx_1220092 | limit_orders_mx | distributed | 16384
limit_orders_mx_1220092 | limit_orders_mx | distributed | 16384 limit_orders_mx_1220092 | limit_orders_mx | distributed | 16384
limit_orders_mx_1220092 | limit_orders_mx | distributed | 16384 limit_orders_mx_1220092 | limit_orders_mx | distributed | 16384
@ -878,6 +921,12 @@ SELECT shard_name, table_name, citus_table_type, shard_size FROM citus_shards OR
nation_mx_1220085 | nation_mx | reference | 0 nation_mx_1220085 | nation_mx | reference | 0
nation_mx_1220085 | nation_mx | reference | 0 nation_mx_1220085 | nation_mx | reference | 0
objects_mx_1220103 | objects_mx | distributed | 16384 objects_mx_1220103 | objects_mx | distributed | 16384
objects_mx_1220103 | objects_mx | distributed | 16384
objects_mx_1220103 | objects_mx | distributed | 16384
objects_mx_1220103 | objects_mx | distributed | 16384
objects_mx_1220103 | objects_mx | distributed | 16384
objects_mx_1220103 | objects_mx | distributed | 16384
objects_mx_1220103 | objects_mx | distributed | 16384
orders_mx_1220068 | orders_mx | distributed | 8192 orders_mx_1220068 | orders_mx | distributed | 8192
orders_mx_1220068 | orders_mx | distributed | 8192 orders_mx_1220068 | orders_mx | distributed | 8192
orders_mx_1220068 | orders_mx | distributed | 8192 orders_mx_1220068 | orders_mx | distributed | 8192
@ -966,7 +1015,7 @@ SELECT shard_name, table_name, citus_table_type, shard_size FROM citus_shards OR
supplier_mx_1220087 | supplier_mx | reference | 0 supplier_mx_1220087 | supplier_mx | reference | 0
supplier_mx_1220087 | supplier_mx | reference | 0 supplier_mx_1220087 | supplier_mx | reference | 0
supplier_mx_1220087 | supplier_mx | reference | 0 supplier_mx_1220087 | supplier_mx | reference | 0
(451 rows) (477 rows)
-- Show that altering type name is not supported from worker node -- Show that altering type name is not supported from worker node
ALTER TYPE citus_mx_test_schema.order_side_mx RENAME TO temp_order_side_mx; ALTER TYPE citus_mx_test_schema.order_side_mx RENAME TO temp_order_side_mx;

View File

@ -294,7 +294,7 @@ DROP TABLE shard_count_table_3;
-- test shard count 1 placement with colocate none. -- test shard count 1 placement with colocate none.
-- create a base table instance -- create a base table instance
set citus.enable_single_hash_repartition_joins to on; set citus.enable_single_shard_table_multi_node_placement to on;
CREATE TABLE shard_count_table_1_inst_1 (a int); CREATE TABLE shard_count_table_1_inst_1 (a int);
SELECT create_distributed_table('shard_count_table_1_inst_1', 'a', shard_count:=1, colocate_with:='none'); SELECT create_distributed_table('shard_count_table_1_inst_1', 'a', shard_count:=1, colocate_with:='none');
@ -312,7 +312,7 @@ SELECT shard_count = 1 FROM citus_tables WHERE table_name = 'shard_count_table_1
-- check placement: These should be placed on different workers. -- check placement: These should be placed on different workers.
SELECT nodename || ':' || nodeport AS inst_1_node_endpoint FROM citus_shards WHERE table_name = 'shard_count_table_1_inst_1'::regclass \gset SELECT nodename || ':' || nodeport AS inst_1_node_endpoint FROM citus_shards WHERE table_name = 'shard_count_table_1_inst_1'::regclass \gset
SELECT nodename || ':' || nodeport AS inst_2_node_endpoint FROM citus_shards WHERE table_name = 'shard_count_table_1_inst_2'::regclass \gset SELECT nodename || ':' || nodeport AS inst_2_node_endpoint FROM citus_shards WHERE table_name = 'shard_count_table_1_inst_2'::regclass \gset
SELECT :'inst_1_node_endpoint' = :'inst_2_node_endpoint'; SELECT :'inst_1_node_endpoint', :'inst_2_node_endpoint', :'inst_1_node_endpoint' = :'inst_2_node_endpoint';
DROP TABLE shard_count_table_1_inst_1; DROP TABLE shard_count_table_1_inst_1;
DROP TABLE shard_count_table_1_inst_2; DROP TABLE shard_count_table_1_inst_2;

View File

@ -383,6 +383,14 @@ SET citus.shard_count TO 4;
CREATE TABLE company_employees_mx (company_id int, employee_id int, manager_id int); CREATE TABLE company_employees_mx (company_id int, employee_id int, manager_id int);
SELECT create_distributed_table('company_employees_mx', 'company_id'); SELECT create_distributed_table('company_employees_mx', 'company_id');
CREATE TABLE articles_single_shard_hash_mx_partition_inst1 (LIKE articles_single_shard_hash_mx);
CREATE TABLE articles_single_shard_hash_mx_partition_inst2 (LIKE articles_single_shard_hash_mx);
SET citus.shard_count TO 1;
SET citus.enable_single_shard_table_multi_node_placement to on;
SELECT create_distributed_table('articles_single_shard_hash_mx_partition_inst1', 'author_id', colocate_with => 'none');
SELECT create_distributed_table('articles_single_shard_hash_mx_partition_inst2', 'author_id', colocate_with => 'none');
set citus.enable_single_shard_table_multi_node_placement to off;
WITH shard_counts AS ( WITH shard_counts AS (
SELECT logicalrelid, count(*) AS shard_count FROM pg_dist_shard GROUP BY logicalrelid SELECT logicalrelid, count(*) AS shard_count FROM pg_dist_shard GROUP BY logicalrelid
) )