Re: MultiXact truncation, startup et al.

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: MultiXact truncation, startup et al.
Date: 2013-11-29 08:09:54
Message-ID: 20131129080954.GB5645@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Thanks, looks saner than my version ;)

On 2013-11-29 01:00:35 -0300, Alvaro Herrera wrote:
> ! /*
> ! * FIXME this calls TransactionIdDidAbort() internally,
> ! * falsifying the claim in the comment at the top ...
> ! */
> ! update_xid = HeapTupleGetUpdateXid(tuple);

Yea. I think we should remove that behaviour from
HeapTupleGetUpdateXid() - we don't need to rely on it here.

> ! /*
> ! * XXX we rely here on HeapTupleGetUpdateXid returning
> ! * Invalid for aborted updates.
> ! */
> ! if (!TransactionIdIsValid(update_xid))
> ! freeze_xmax = true;

I've just added this case because HeapTupleGetUpdateXid() currently can
return InvalidTransactionId - I'd be perfectly fine to just place the
aborted xid in there.

> ! * FIXME -- what if it's a committed update which has recent
> ! * new locker transaction? The tuple wouldn't have been
> ! * removed in that case (HeapTupleSatisfiesVacuum returns
> ! * RECENTLY_DEAD).
> ! */

Afaics we should be protected against that by virtue of GetOldestMultiXactId().

> ***************
> *** 5645,5668 **** heap_tuple_needs_freeze(HeapTupleHeader tuple, TransactionId cutoff_xid,
> ! /* we don't care about lockers */
> ! if (members[i].status != MultiXactStatusNoKeyUpdate ||
> ! members[i].status == MultiXactStatusUpdate)
> ! continue;

Dangerous typo alert. Should also be replaced by
ISUPDATE_from_mxstatus(). Alternatively, if we decide to make
HeapTupleGetUpdateXid() not make that DidAbort() check, we can simply
get rid of doing the loop ourselves alltogethers.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Antonin Houska 2013-11-29 08:54:28 Re: Todo item: Support amgettuple() in GIN
Previous Message Pavel Stehule 2013-11-29 08:06:05 Re: Re: [BUGS] BUG #7873: pg_restore --clean tries to drop tables that don't exist