citusdata / citus

Distributed PostgreSQL as an extension
https://www.citusdata.com
GNU Affero General Public License v3.0
10.67k stars 671 forks source link

Deadlock detection does not catch self-deadlocks with run_command_on* #1572

Open marcocitus opened 7 years ago

marcocitus commented 7 years ago

To create a self-deadlock:

BEGIN;
ALTER TABLE test ADD COLUMN z int;
SELECT run_command_on_placements('test', 'SELECT x FROM %s');
anarazel commented 7 years ago

Hm, I kind of assumed we'd not try to detect these. Think we'd have to check for a node's visited status after checking whether we've refound the start node. Then we should detect these too. (Plus some assert weakening)

onderkalaci commented 7 years ago

Hm, I kind of assumed we'd not try to detect these.

Thinking about this some more, it looks like detecting self-deadlocks doesn't help much to anyone. Because it's very likely that the user wouldn't be able to finish such a transaction anytime ever.

The only benefit would be Citus cancels the transaction instead of waiting for the user to cancel it and the user realizes not to use such patters.