Re: [HACKERS] [COMMITTERS] pgsql: Fix freezing of a dead HOT-updated tuple

From: Andres Freund <andres(at)anarazel(dot)de>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: "Wood, Dan" <hexpert(at)amazon(dot)com>, Peter Geoghegan <pg(at)bowt(dot)ie>, pgsql-committers(at)postgresql(dot)org, "Wong, Yi Wen" <yiwong(at)amazon(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] [COMMITTERS] pgsql: Fix freezing of a dead HOT-updated tuple
Date: 2017-12-15 02:30:59
Message-ID: 20171215023059.oeyindn57oeis5um@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On 2017-12-14 17:00:29 -0800, Andres Freund wrote:
> Hi,
>
> On 2017-11-13 19:03:41 -0800, Andres Freund wrote:
> > diff --git a/src/backend/access/heap/rewriteheap.c b/src/backend/access/heap/rewriteheap.c
> > index f93c194e182..7d163c91379 100644
> > --- a/src/backend/access/heap/rewriteheap.c
> > +++ b/src/backend/access/heap/rewriteheap.c
> > @@ -407,7 +407,10 @@ rewrite_heap_tuple(RewriteState state,
> > * While we have our hands on the tuple, we may as well freeze any
> > * eligible xmin or xmax, so that future VACUUM effort can be saved.
> > */
> > - heap_freeze_tuple(new_tuple->t_data, state->rs_freeze_xid,
> > + heap_freeze_tuple(new_tuple->t_data,
> > + state->rs_old_rel->rd_rel->relfrozenxid,
> > + state->rs_old_rel->rd_rel->relminmxid,
> > + state->rs_freeze_xid,
> > state->rs_cutoff_multi);
>
> Hm. So this requires backpatching the introduction of
> RewriteStateData->rs_old_rel into 9.3, which in turn requires a new
> argument to begin_heap_rewrite(). It originally was added in the
> logical decoding commit (i.e. 9.4).
>
> I'm fine with that, but it could theoretically cause issues for somebody
> with an extension that calls begin_heap_rewrite() - which seems unlikely
> and I couldn't find any that does so.
>
> Does anybody have a problem with that?

Pushed this way. Moved some more relfrozenxid/relminmxid tests outside
of the cutoff changes, polished some error messages.

Alvaro, Michael, Peter, and everyone else I'd greatly appreciate if you
could have a look at the backported version, just about everything but
v10 had conflicts, some of them not insubstantial.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2017-12-15 11:25:22 Re: [HACKERS] [COMMITTERS] pgsql: Fix freezing of a dead HOT-updated tuple
Previous Message Andres Freund 2017-12-15 02:28:56 pgsql: Perform a lot more sanity checks when freezing tuples.

Browse pgsql-hackers by date

  From Date Subject
Next Message Craig Ringer 2017-12-15 02:34:14 Re: Using ProcSignal to get memory context stats from a running backend
Previous Message Peter Geoghegan 2017-12-15 01:58:39 Re: PostgreSQL crashes with SIGSEGV