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-20 20:48:52
Message-ID: 20140720204852.GB5974@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 2014-07-20 16:16:18 -0400, Tom Lane wrote:
> Andres Freund <andres(at)2ndquadrant(dot)com> writes:
> > On 2014-07-20 13:37:01 -0400, Tom Lane wrote:
> >> I started transcribing Bruce's proposed fix procedure at
> >> https://wiki.postgresql.org/wiki/20140702pg_upgrade_fix
> >> into the release notes, but I'm afraid it's all wet.
>
> > I don't understand why we should do anything but remove the 0000 file if
> > it's all zeroes? This seems far too complicated. Beside the fact that I
> > doubt it's actually achieving anything reliably?
>
> This one is not about the extra 0000 file. It's about whether datminmxid
> and relminmxid are wrong. In the previous coding of pg_upgrade, they'd
> have been left at "1" even if that value has wrapped around into the
> future.

Yea, I'm rereading the thread atm. I'd stopped following it after a
while and didn't notice the drift into a second problem.

> Now, if you were lucky, you'd have no bad side-effects even if they had
> wrapped around ...

Hm. If relminmxid = 1 is still in the past everything should be fine,
right? The next vacuum (which will run soon) will just set it anew. But
if not
/* relminmxid must never go backward, either */
if (MultiXactIdIsValid(minmulti) &&
MultiXactIdPrecedes(pgcform->relminmxid, minmulti))
{
pgcform->relminmxid = minmulti;
dirty = true;
}
will prevent it from being changed. Similarly
/* ditto */
if (MultiXactIdPrecedes(dbform->datminmxid, newMinMulti))
{
dbform->datminmxid = newMinMulti;
dirty = true;
}
will prevent datminmxid from becoming sane.

vac_truncate_clog() will be called with ReadNextMultiXactId() - -
autovacuum_multixact_freeze_max_age as the truncation for multis. That
itself would be fine since there won't be any actual multis in that
range. The problem is that we might miss having to do a full table
vacuum because
we check relminmxid to determine that:
scan_all |= MultiXactIdPrecedesOrEquals(onerel->rd_rel->relminmxid,
mxactFullScanLimit);
which then could cause problems in the future.

Imo that means we need to fix this :( for existing clusters.

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 Andres Freund 2014-07-20 21:04:08 Re: pg_upgrade < 9.3 -> >=9.3 misses a step around multixacts
Previous Message Tom Lane 2014-07-20 20:16:18 Re: pg_upgrade < 9.3 -> >=9.3 misses a step around multixacts