Re: deadlock in single-row select-for-update + update scenario? How could it happen?

From: hubert depesz lubaczewski <depesz(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: deadlock in single-row select-for-update + update scenario? How could it happen?
Date: 2014-08-22 17:51:55
Message-ID: CAKrjmhfW7PO5CaH=XqiZ6Nr566pww=MkmUmEPcTrq2RU0iMsjg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Aug 22, 2014 at 7:49 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> You have not shown us the full sequence of events leading up to the
> deadlock failure, but I hypothesize that there were yet other transactions
> that updated that same row in the very recent past. That might allow
> there to be more than one tuple lock involved (ie, locks on different
> versions of the row), which would create some scope for a deadlock
> failure.
>

Well, showing all events is difficult due to parallelization of importer,
but shouldn't "select for update" solve the problem of other locks?

The transactions are exactly as shown - select for update and then update.

depesz

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2014-08-22 17:54:25 Re: deadlock in single-row select-for-update + update scenario? How could it happen?
Previous Message hubert depesz lubaczewski 2014-08-22 17:50:44 Re: deadlock in single-row select-for-update + update scenario? How could it happen?