Re: deadlock_timeout at < PGC_SIGHUP?

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Noah Misch <noah(at)leadboat(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: deadlock_timeout at < PGC_SIGHUP?
Date: 2011-03-29 14:15:50
Message-ID: AANLkTik77byjo3bMs9M0AG+6CQp9jvZLPyQN0nFBEi7D@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 29, 2011 at 2:20 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>  IIRC, the
> current deadlock detector always kills the process that detected the
> deadlock, but I *think* that's just a random choice and not an essential
> feature.  If so, it'd be pretty easy to instead kill the lowest-priority
> xact among those involved in the deadlock.

I think it was just easier. To kill yourself you just exit with an
error. To kill someone else you have to deliver a signal and hope the
other process exits cleanly.

There are a bunch of things to wonder about too. If you don't kill
yourself then you might still be in a deadlock cycle so presumably you
have to reset the deadlock timer? What if two backends both decide to
kill the same other backend. Does it handle getting a spurious signal
late cleanly? How does it know which transaction the signal was for?

Alternatively we could have the deadlock timer reset all the time and
fire repeatedly. Then we could just have all backends ignore the
deadlock if they're not the lowest priority session in the cycle. But
this depends on everyone knowing everyone else's priority (and having
a consistent view of it).

--
greg

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2011-03-29 14:23:27 Re: deadlock_timeout at < PGC_SIGHUP?
Previous Message Kevin Grittner 2011-03-29 13:49:03 Re: Problem with streaming replication, backups, and recovery (9.0.x)