Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deadlock when specifying constraint name for a parent table with a partition with a long name #7799

Open
naisila opened this issue Dec 20, 2024 · 1 comment

Comments

@naisila
Copy link
Member

naisila commented Dec 20, 2024

Steps to reproduce:

-- create partitioned table
CREATE TABLE distributed_partitioned_table (
    id serial NOT NULL,
    partition_col int NOT NULL,
    PRIMARY KEY (id, partition_col)
) PARTITION BY RANGE (partition_col);

-- add normal length name partition
CREATE TABLE distributed_partitioned_table_p1 PARTITION OF distributed_partitioned_table 
FOR VALUES FROM (1) TO (100);

-- add long name partition
CREATE TABLE distributed_partitioned_table_p2_longlonglonglonglonglonglong_name PARTITION OF distributed_partitioned_table 
FOR VALUES FROM (100) TO (200);

-- distribute
SELECT create_distributed_table('distributed_partitioned_table', 'id');

-- Add a unique constraint with a name to the distributed partitioned table
-- this seems to deadlock sometimes for the long name partition
SET client_min_messages TO DEBUG1;
ALTER TABLE distributed_partitioned_table ADD CONSTRAINT dist_unique_named UNIQUE(id, partition_col);

ERROR:  canceling the transaction since it was involved in a distributed deadlock
@naisila
Copy link
Member Author

naisila commented Dec 20, 2024

We are only calling PrepareAlterTableStmtForConstraint in cases where we don't have a constraint name specified in the DDL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant