mirror of https://github.com/citusdata/citus.git
A test with non-deterministic results illustrating the bug.
parent
12f56438fc
commit
aeded49fc8
|
@ -0,0 +1,62 @@
|
||||||
|
--- Test for updating a table that has a foreign key reference to another reference table.
|
||||||
|
--- Issue #7477: Distributed deadlock after issuing a simple UPDATE statement
|
||||||
|
--- https://github.com/citusdata/citus/issues/7477
|
||||||
|
CREATE TABLE table1 (id INT PRIMARY KEY);
|
||||||
|
SELECT create_reference_table('table1');
|
||||||
|
create_reference_table
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
INSERT INTO table1 VALUES (1);
|
||||||
|
CREATE TABLE table2 (
|
||||||
|
id INT,
|
||||||
|
info TEXT,
|
||||||
|
CONSTRAINT table1_id_fk FOREIGN KEY (id) REFERENCES table1 (id)
|
||||||
|
);
|
||||||
|
SELECT create_reference_table('table2');
|
||||||
|
create_reference_table
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
INSERT INTO table2 VALUES (1, 'test');
|
||||||
|
--- Runs the update command in parallel on workers.
|
||||||
|
--- Due to bug #7477, before the fix, the result is non-deterministic
|
||||||
|
--- and have several rows of the form:
|
||||||
|
--- localhost | 57638 | f | ERROR: deadlock detected
|
||||||
|
--- localhost | 57637 | f | ERROR: deadlock detected
|
||||||
|
--- localhost | 57637 | f | ERROR: canceling the transaction since it was involved in a distributed deadlock
|
||||||
|
SELECT * FROM master_run_on_worker(
|
||||||
|
ARRAY['localhost', 'localhost','localhost', 'localhost','localhost',
|
||||||
|
'localhost','localhost', 'localhost','localhost', 'localhost']::text[],
|
||||||
|
ARRAY[57638, 57637, 57637, 57638, 57637, 57638, 57637, 57638, 57638, 57637]::int[],
|
||||||
|
ARRAY['UPDATE table2 SET info = ''test_update'' WHERE id = 1',
|
||||||
|
'UPDATE table2 SET info = ''test_update'' WHERE id = 1',
|
||||||
|
'UPDATE table2 SET info = ''test_update'' WHERE id = 1',
|
||||||
|
'UPDATE table2 SET info = ''test_update'' WHERE id = 1',
|
||||||
|
'UPDATE table2 SET info = ''test_update'' WHERE id = 1',
|
||||||
|
'UPDATE table2 SET info = ''test_update'' WHERE id = 1',
|
||||||
|
'UPDATE table2 SET info = ''test_update'' WHERE id = 1',
|
||||||
|
'UPDATE table2 SET info = ''test_update'' WHERE id = 1',
|
||||||
|
'UPDATE table2 SET info = ''test_update'' WHERE id = 1',
|
||||||
|
'UPDATE table2 SET info = ''test_update'' WHERE id = 1'
|
||||||
|
]::text[],
|
||||||
|
true);
|
||||||
|
node_name | node_port | success | result
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
localhost | 57638 | f | ERROR: deadlock detected
|
||||||
|
localhost | 57637 | t | UPDATE 1
|
||||||
|
localhost | 57637 | f | ERROR: deadlock detected
|
||||||
|
localhost | 57638 | f | ERROR: deadlock detected
|
||||||
|
localhost | 57637 | f | ERROR: canceling the transaction since it was involved in a distributed deadlock
|
||||||
|
localhost | 57638 | f | ERROR: deadlock detected
|
||||||
|
localhost | 57637 | f | ERROR: deadlock detected
|
||||||
|
localhost | 57638 | f | ERROR: deadlock detected
|
||||||
|
localhost | 57638 | f | ERROR: canceling the transaction since it was involved in a distributed deadlock
|
||||||
|
localhost | 57637 | f | ERROR: deadlock detected
|
||||||
|
(10 rows)
|
||||||
|
|
||||||
|
--- cleanup
|
||||||
|
DROP TABLE table2;
|
||||||
|
DROP TABLE table1;
|
|
@ -103,7 +103,7 @@ test: multi_dropped_column_aliases foreign_key_restriction_enforcement
|
||||||
test: binary_protocol
|
test: binary_protocol
|
||||||
test: alter_table_set_access_method
|
test: alter_table_set_access_method
|
||||||
test: alter_distributed_table
|
test: alter_distributed_table
|
||||||
test: issue_5248 issue_5099 issue_5763 issue_6543 issue_6758
|
test: issue_5248 issue_5099 issue_5763 issue_6543 issue_6758 issue_7477
|
||||||
test: object_propagation_debug
|
test: object_propagation_debug
|
||||||
test: undistribute_table
|
test: undistribute_table
|
||||||
test: run_command_on_all_nodes
|
test: run_command_on_all_nodes
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
|
||||||
|
--- Test for updating a table that has a foreign key reference to another reference table.
|
||||||
|
--- Issue #7477: Distributed deadlock after issuing a simple UPDATE statement
|
||||||
|
--- https://github.com/citusdata/citus/issues/7477
|
||||||
|
|
||||||
|
CREATE TABLE table1 (id INT PRIMARY KEY);
|
||||||
|
SELECT create_reference_table('table1');
|
||||||
|
INSERT INTO table1 VALUES (1);
|
||||||
|
|
||||||
|
CREATE TABLE table2 (
|
||||||
|
id INT,
|
||||||
|
info TEXT,
|
||||||
|
CONSTRAINT table1_id_fk FOREIGN KEY (id) REFERENCES table1 (id)
|
||||||
|
);
|
||||||
|
SELECT create_reference_table('table2');
|
||||||
|
INSERT INTO table2 VALUES (1, 'test');
|
||||||
|
|
||||||
|
--- Runs the update command in parallel on workers.
|
||||||
|
--- Due to bug #7477, before the fix, the result is non-deterministic
|
||||||
|
--- and have several rows of the form:
|
||||||
|
--- localhost | 57638 | f | ERROR: deadlock detected
|
||||||
|
--- localhost | 57637 | f | ERROR: deadlock detected
|
||||||
|
--- localhost | 57637 | f | ERROR: canceling the transaction since it was involved in a distributed deadlock
|
||||||
|
|
||||||
|
SELECT * FROM master_run_on_worker(
|
||||||
|
ARRAY['localhost', 'localhost','localhost', 'localhost','localhost',
|
||||||
|
'localhost','localhost', 'localhost','localhost', 'localhost']::text[],
|
||||||
|
ARRAY[57638, 57637, 57637, 57638, 57637, 57638, 57637, 57638, 57638, 57637]::int[],
|
||||||
|
ARRAY['UPDATE table2 SET info = ''test_update'' WHERE id = 1',
|
||||||
|
'UPDATE table2 SET info = ''test_update'' WHERE id = 1',
|
||||||
|
'UPDATE table2 SET info = ''test_update'' WHERE id = 1',
|
||||||
|
'UPDATE table2 SET info = ''test_update'' WHERE id = 1',
|
||||||
|
'UPDATE table2 SET info = ''test_update'' WHERE id = 1',
|
||||||
|
'UPDATE table2 SET info = ''test_update'' WHERE id = 1',
|
||||||
|
'UPDATE table2 SET info = ''test_update'' WHERE id = 1',
|
||||||
|
'UPDATE table2 SET info = ''test_update'' WHERE id = 1',
|
||||||
|
'UPDATE table2 SET info = ''test_update'' WHERE id = 1',
|
||||||
|
'UPDATE table2 SET info = ''test_update'' WHERE id = 1'
|
||||||
|
]::text[],
|
||||||
|
true);
|
||||||
|
|
||||||
|
--- cleanup
|
||||||
|
DROP TABLE table2;
|
||||||
|
DROP TABLE table1;
|
Loading…
Reference in New Issue