Re: Assertion failure in REL9_5_STABLE - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Assertion failure in REL9_5_STABLE
Date
Msg-id 20160810210129.GA627089@alvherre.pgsql
Whole thread Raw
In response to Re: Assertion failure in REL9_5_STABLE  (Marko Tiikkaja <marko@joh.to>)
Responses Re: Assertion failure in REL9_5_STABLE
Re: Assertion failure in REL9_5_STABLE
List pgsql-hackers
Marko Tiikkaja wrote:
> On 2016-08-10 19:28, Alvaro Herrera wrote:
> >Umm.  AFAICS HeapTupleSatisfiesUpdate() only returns SelfUpdated after
> >already calling HeapTupleHeaderGetCmax() (which obviously hasn't caught
> >the same assertion).  Something is odd there ...
> 
> HeapTupleSatisfiesUpdate() returns HeapTupleBeingUpdated in this case.
> HeapTupleSelfUpdated comes from here (line 4749):
> 
>     /* if there are updates, follow the update chain */
>     if (follow_updates && !HEAP_XMAX_IS_LOCKED_ONLY(infomask))
>     {
>         HTSU_Result res;
>         res = heap_lock_updated_tuple(relation, tuple, &t_ctid,
>                                       GetCurrentTransactionId(),
>                                       mode);
>         if (res != HeapTupleMayBeUpdated)
>         {
>             result = res;
>             /* recovery code expects to have buffer lock held */
>             LockBuffer(*buffer, BUFFER_LOCK_EXCLUSIVE);
>             goto failed;
>          }
>      }

Oh, I see ... so there's an update chain, and you're updating a earlier
tuple.  But the later tuple has a multixact and one of the members is
the current transaction.

I wonder how can you lock a tuple that's not the latest, where that
update chain was produced by your own transaction.  I suppose this is
because of plpgsql use of cursors.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: M Enrique
Date:
Subject: Re: Gin index on array of uuid
Next
From: Tom Lane
Date:
Subject: Re: new pgindent run before branch?