Fix shard id difference for enterprise

pull/5016/head
Ahmet Gedemenli 2021-06-01 17:16:40 +03:00
parent 4c20bf7a36
commit 0fbddc740d
2 changed files with 8 additions and 6 deletions

View File

@ -1947,6 +1947,7 @@ ORDER BY
"schema-test_2009" | 4
(2 rows)
SET citus.next_shard_id TO 1660300;
-- test we don't deadlock when attaching and detaching partitions from partitioned
-- tables with foreign keys
CREATE TABLE reference_table(id int PRIMARY KEY);
@ -2001,8 +2002,8 @@ INSERT INTO partitioning_test_2010 VALUES (1, '2010-02-01');
-- This should fail because of foreign key constraint violation
ALTER TABLE partitioning_test ATTACH PARTITION partitioning_test_2010
FOR VALUES FROM ('2010-01-01') TO ('2011-01-01');
ERROR: insert or update on table "partitioning_test_2010_1660191" violates foreign key constraint "partitioning_reference_fkey_1660179"
DETAIL: Key (id)=(X) is not present in table "reference_table_1660177".
ERROR: insert or update on table "partitioning_test_2010_1660314" violates foreign key constraint "partitioning_reference_fkey_1660302"
DETAIL: Key (id)=(X) is not present in table "reference_table_1660300".
CONTEXT: while executing command on localhost:xxxxx
-- Truncate, so attaching again won't fail
TRUNCATE partitioning_test_2010;
@ -2093,14 +2094,14 @@ DETAIL: Table "<dropped>" is modified, which might lead to data inconsistencies
CONTEXT: SQL statement "SELECT citus_drop_all_shards(v_obj.objid, v_obj.schema_name, v_obj.object_name)"
PL/pgSQL function citus_drop_trigger() line 16 at PERFORM
DEBUG: drop cascades to 2 other objects
DETAIL: drop cascades to constraint partitioning_reference_fkey_1660179 on table partitioning_schema.partitioning_test_1660179
drop cascades to constraint partitioning_reference_fkey_1660181 on table partitioning_schema.partitioning_test_1660181
DETAIL: drop cascades to constraint partitioning_reference_fkey_1660302 on table partitioning_schema.partitioning_test_1660302
drop cascades to constraint partitioning_reference_fkey_1660304 on table partitioning_schema.partitioning_test_1660304
DETAIL: from localhost:xxxxx
CONTEXT: SQL statement "SELECT citus_drop_all_shards(v_obj.objid, v_obj.schema_name, v_obj.object_name)"
PL/pgSQL function citus_drop_trigger() line 16 at PERFORM
DEBUG: drop cascades to 2 other objects
DETAIL: drop cascades to constraint partitioning_reference_fkey_1660180 on table partitioning_schema.partitioning_test_1660180
drop cascades to constraint partitioning_reference_fkey_1660182 on table partitioning_schema.partitioning_test_1660182
DETAIL: drop cascades to constraint partitioning_reference_fkey_1660303 on table partitioning_schema.partitioning_test_1660303
drop cascades to constraint partitioning_reference_fkey_1660305 on table partitioning_schema.partitioning_test_1660305
DETAIL: from localhost:xxxxx
CONTEXT: SQL statement "SELECT citus_drop_all_shards(v_obj.objid, v_obj.schema_name, v_obj.object_name)"
PL/pgSQL function citus_drop_trigger() line 16 at PERFORM

View File

@ -1164,6 +1164,7 @@ GROUP BY
ORDER BY
1,2;
SET citus.next_shard_id TO 1660300;
-- test we don't deadlock when attaching and detaching partitions from partitioned
-- tables with foreign keys