Re: Deadlock bug

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Joel Jacobson" <joel(at)gluefinance(dot)com>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Magnus Hagander" <magnus(at)hagander(dot)net>,<glue(at)pgexperts(dot)com>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Deadlock bug
Date: 2010-08-20 14:29:18
Message-ID: 4C6E4AEE0200002500034972@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> You didn't tell us exactly what the FK relationship is

The original post has an attachment with a self-contained example,
starting with table creation.

> I suspect the reason for the deadlock is that one process is
> trying to update a row that references some row already updated by
> the other.

The surprising thing is that a particular row is (using the
identifiers from the attachment):

Process 2 updates a particular row without blocking.
Process 1 updates the same row, which blocks.
Process 2 updates the same row again (with *exactly* the same UPDATE
statement), which fails with a deadlock.

I'm not sure I consider that a bug, but it moves the needle on the
astonishment meter.

-Kevin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-08-20 14:30:46 Re: small smgrcreate cleanup patch
Previous Message Tom Lane 2010-08-20 14:28:04 Interruptible sleeps (was Re: CommitFest 2009-07: Yay, Kevin! Thanks, reviewers!)