Re: Reviewing freeze map code

From: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Reviewing freeze map code
Date: 2016-06-20 22:59:25
Message-ID: CAEepm=1hgCCz1PZyhuPj0=ybsq601QotQbaOA=skqsaMMO5ARQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jun 17, 2016 at 3:36 PM, Noah Misch <noah(at)leadboat(dot)com> wrote:
> I agree the non-atomic, unlogged change is a problem. A related threat
> doesn't require a torn page:
>
> AssignTransactionId() xid=123
> heapam.c:3931 HeapTupleHeaderSetXmax(oldtup.t_data, 123);
> some ERROR before heap_update() finishes
> rollback; -- xid=123
> some backend flushes the modified page
> immediate shutdown
> AssignTransactionId() xid=123
> commit; -- xid=123
>
> If nothing wrote an xlog record that witnesses xid 123, the cluster can
> reassign it after recovery. The failed update is now considered a successful
> update, and the row improperly becomes dead. That's important.

I wonder if that was originally supposed to be handled with the
HEAP_XMAX_UNLOGGED flag which was removed in 11919160. A comment in
the heap WAL logging commit f2bfe8a2 said that tqual routines would
see the HEAP_XMAX_UNLOGGED flag in the event of a crash before logging
(though I'm not sure if the tqual routines ever actually did that).

--
Thomas Munro
http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2016-06-20 23:05:40 Re: parallel.c is not marked as test covered
Previous Message Tom Lane 2016-06-20 22:50:14 Re: parallel.c is not marked as test covered