Skip to content

unable to add node when distribution columns have different collation types #7683

@mtuncer

Description

@mtuncer

Description

  • two tables were created in a single node cluster, with text type but different collations ( C versus default)
  • both tables were distributed using create distributed table call
  • noticed they were colocated
  • attempt to add a new node fails
  • alter table alter column command to set the collation is rejected by coordinator due to it is being distribution key

Expected

  • Either created_distributed_table should fail or citus_add_node should succeed

Detailed repro steps

citus=> select version();
-------------------------------------------------------------------------------------------------------------------------------------
 PostgreSQL 14.13 (Ubuntu 14.13-1.pgdg20.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0, 64-bit 
(1 row) 

citus=> select citus_version();
----------------------------------------------------------------------------------------------------
 Citus 12.1.5 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0, 64-bit 
(1 row) 

citus=> create table t1 ( a text collate "C", b text collate "C"); 
CREATE TABLE 
citus=> \d t1 
Table "public.t1" 
Column | Type | Collation | Nullable | Default 
--------+------+-----------+----------+--------- 
 a      | text | C         |          | 
 b      | text | C         |          | 
citus=> create table t2( a text, b text); 
CREATE TABLE 
citus=> select create_distributed_table('t1', 'a'); 
create_distributed_table 
-------------------------- 
(1 row)
citus=> select create_distributed_table('t2', 'a');
create_distributed_table 
--------------------------
(1 row)
citus=>

citus=> select * from pg_dist_partition;     
 logicalrelid | partmethod |                                                          partkey                                                           | colocationid | repmodel | autoconverted   
--------------+------------+----------------------------------------------------------------------------------------------------------------------------+--------------+----------+---------------   
 t1           | h          | {VAR :varno 1 :varattno 1 :vartype 25 :vartypmod -1 :varcollid 950 :varlevelsup 0 :varnosyn 1 :varattnosyn 1 :location -1} |            1 | s        | f        
 t2           | h          | {VAR :varno 1 :varattno 1 :vartype 25 :vartypmod -1 :varcollid 100 :varlevelsup 0 :varnosyn 1 :varattnosyn 1 :location -1} |            1 | s        | f       
(2 rows)  

citus=> select * from pg_collation where oid = 100 or oid=950; 
 oid | collname | collnamespace | collowner | collprovider | collisdeterministic | collencoding | collcollate | collctype | collversion
-----+----------+---------------+-----------+--------------+---------------------+--------------+-------------+-----------+-------------
 100 | default  |            11 |        10 | d            | t                   |           -1 |             |           |
 950 | C        |            11 |        10 | c            | t                   |           -1 | C           | C         |
(2 rows)   

select citus_add_node('<redacted>', 5432);
NOTICE:  shards are still on the coordinator after adding the new node
HINT:  Use SELECT rebalance_table_shards(); to balance shards data between workers and coordinator or SELECT citus_drain_node('<redacted>',5432); to permanently move shards away from the coordinator.
WARNING:  cannot colocate tables t2 and t1 
DETAIL:  Distribution column collations don't match for t2 and t1.  
ERROR:  failure on connection marked as essential: <redacted>:5432

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions