Re: uninterruptable loop: concurrent delete in progress within table

From: Kevin Grittner <kgrittn(at)ymail(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>, Sandro Santilli <strk(at)keybit(dot)net>
Subject: Re: uninterruptable loop: concurrent delete in progress within table
Date: 2014-06-07 21:27:20
Message-ID: 1402176440.76325.YahooMailNeo@web122301.mail.ne1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Andres Freund <andres(at)2ndquadrant(dot)com> wrote:

> I do wonder if any of the other existing callers of HTSV are
> affected. I don't understand predicate.c well enough to be sure,
> but it looks to me like it'd could in theory lead to missed
> conflicts. Seems fairly unlikely to matter in practice though.

Early in the evaluation of the multi-xact bugs around 9.3 someone
pointed out that the serializable transactions could be affected. I
looked at it then, and it was very hard to set up a case to
actually hit that, and there were no field reports of it, so I
figured I should let the dust settle on fixes in this area before
deciding what to do.  It appeared that the fixes being made for
other reasons might fix this as well.  So far I haven't gotten the
feeling that this area has yet settled down enough to get back to
this.  Perhaps we've now gotten to that point?

Have we really pinned down the semantics of the the return values
for HeapTupleSatisfiesVacuum() at this point?  If so, I guess the
next question is, where is the exact meaning of each return value
documented?  The five to seven word comments in the enum value
declaration *seem* clear on the face of it, but I don't actually
have confidence what they really mean when, for example, a
subtransaction has rolled back.  It appears that
HEAPTUPLE_INSERT_IN_PROGRESS can be returned for a DELETE under
some circumstances, but it would take a lot of work to reverse-
engineer exactly what the various conditions that can cause that
return value are.  It seems like someone who knows what these
values really mean should capture that in a code comment somewhere.

What the code in predicate.c is using this for is to determine, for
a given tuple which the calling process is reading, whether it is
visible to the calling process but has been deleted by another
transaction (whose work this snapshot can't see), or is not visible
to the calling process and has been inserted by another transaction
(whose work this transaction can't see).  To qualify, the change
from the other transaction must be either committed or still
pending (i.e., it might commit).  With the tuple's visibility to
the current process known, what return values answer that question
without further checking, and what further checking is needed for
which other return codes?

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2014-06-07 21:49:12 Re: uninterruptable loop: concurrent delete in progress within table
Previous Message hannes.janetzek@gmail.com 2014-06-07 16:11:01 Re: BUG #10542: infinite loop in index.c when trying to reindex system tables (probably corrupted db state)