From: Andrew Biagioni <andrew.biagioni@e-greek.net>
To: pgsql-admin@postgresql.org
Subject: Deadlock Checker doesn't see foreign-key locks
Date: Mon, 13 Jan 2003 19:09:14 -0500
Message-ID: <3E23552A.8000801@e-greek.net> (raw)
It appears to me that the Deadlock Checker doesn't see (and thus
release) foreign-key-based locks (see below for details). Am I missing
something? Is there a configuration item I am unaware of?
As far as I can tell (yes, I tested thoroughly) if I create a normal
deadlock situation as follows, the deadlock detector will work properly:
Thread A: BEGIN WORK;
UPDATE [table A, row X]
Thread B: BEGIN WORK;
UPDATE [table B, row Y]
Thread A: UPDATE [table B, row Y]
Thread B: UPDATE [table A, row X]
This is recognized by the deadlock detector (after the specified delay),
one of the two is rolled back, and the other completes happily.
HOWEVER, if I have a foreign-key-related lock, as follows, it is not
recognized:
Thread A: BEGIN WORK;
UPDATE [table A, row W]
/* This has a foreign key into table F, row P */
Thread B: BEGIN WORK;
UPDATE [table B, row Y]
/* This has a foreign key into table G, row Q */
Thread A: UPDATE [table B, row Z]
/* This has a foreign key into table F, row P */
Thread B: UPDATE [table A, row X]
/* This has a foreign key into table G, row Q */
Note that none of the UPDATEs step on the same actual row of the same
table, but they step (and lock) the same rows in the same tables via
foreign keys.
In this case (specifically tested), there is no deadlock detection.
NOTE - I am currently using v7.2.1, although my search through the
release notes lead me to believe that the problem was not addressed
subsequently.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: andrew.biagioni@e-greek.net
Subject: Re: Deadlock Checker doesn't see foreign-key locks
In-Reply-To: <3E23552A.8000801@e-greek.net>
References: <3E23552A.8000801@e-greek.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox