Re: pg_upgrade < 9.3 -> >=9.3 misses a step around multixacts

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, PostgreSQL Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: pg_upgrade < 9.3 -> >=9.3 misses a step around multixacts
Date: 2014-07-21 16:12:22
Message-ID: 20140721161222.GA17049@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 2014-07-20 23:19:30 -0400, Tom Lane wrote:
> I wrote:
> > Here's a draft patch for this. I think this will fix all cases where
> > the "1" minmxid inserted by previous pg_upgrade versions is actually
> > in the future at the time we run VACUUM. We would still be at risk if
> > it had been in the future when pg_upgrade ran but no longer is now,
> > since that would mean there could be non-lock-only mxids on disk that
> > are older than "1". However, for the reasons discussed upthread, it
> > seems fairly unlikely to me that people would actually get burnt in
> > practice, so I'm satisfied with doing this much and no more.
>
> Ah, belay that: as coded, that would allow truncation of clog/multixact
> as soon as any one relation in any one database had sane
> frozenxid/minmxid. If we want to have any pretense of being safe, we have
> to postpone truncation until *all* relations have been vacuumed. So more
> like the attached, instead.

Looks basically good to me. Two minor things:
1) How about adding a elog(WARNING, "relation %u has invalid freeze
limits", ...) to vac_update_datfrozenxid()? Otherwise it's a bit hard
to understand what's going on. I wouldn't want to invest too much effort
into the precision of the message, but some log bleat seems justified.

2) From a pedantic POV lastSane* should be initialized to
ReadNewTransactionId()/ReadNextMultiXactId(). On a busy system we could
otherwise consider concurrently updated values as being too new if some
longrunning transaction finishes. Also GetOldestXmin() can sometimes go
backwards...

Greetings,

Andres Freund

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2014-07-21 16:20:56 Re: pg_upgrade < 9.3 -> >=9.3 misses a step around multixacts
Previous Message Emre Hasegeli 2014-07-21 15:33:49 Re: PostgreSQL 9.3.4 Query Problems