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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Andres Freund <andres(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 17:37:01
Message-ID: 9879.1405877821@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Bruce Momjian <bruce(at)momjian(dot)us> writes:
> On Tue, Jul 1, 2014 at 03:01:06PM -0400, Alvaro Herrera wrote:
>> Finally, there is the question of what to do if the database has already
>> been upgraded and thus the tables are all at relminmxid=1. As far as I
>> can tell, if the original value of nextMulti was below 2^31, there
>> should be no issue because vacuuming would advance the value normally.
>> If the original value was beyond that point, then vacuum would have been
>> bleating all along about the wraparound point. In this case, I think it
>> should be enough the UPDATE the pg_class values to the current
>> oldestMulti value from pg_control, but I haven't tested this.

> Well, we are already having users run a query for the 9.3.X minor
> version upgrade to optionally remove the 0000 file. Is there something
> else they should run to test for this? We certainly could check for
> files >= 8000, but I am not sure that is sufficient. We would then need
> them to somehow update all the database/relation minmxid fields, and I
> am not even sure what value we should set it to. Is that something we
> want to publish?

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.

He's suggesting copying the last checkpoint's NextMultiXactId into
datminmxid/relminmxid, which is surely the wrong thing: that's likely to
be newer than all mxids in the tables, not older than them. I thought at
first that this was a simple thinko and he meant to write oldestMultiXid,
but here's the thing: if we're in the situation where we've got
wraparound, isn't oldestMultiXid going to be 1? The value recorded in the
checkpoint isn't magic, it's just going to be extracted from whatever's in
pg_database; and the whole problem here is that we can't trust that data.
Where can we get a useful lower bound from?

I'm a bit inclined to not say anything about fix procedures in the release
notes, because I'm not sure that this is a problem in the field. If
anybody did have a wraparound they'd be getting bleats from VACUUM, and no
one has reported any such thing that I've heard.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2014-07-20 19:55:25 Re: pg_upgrade < 9.3 -> >=9.3 misses a step around multixacts
Previous Message Amit Kapila 2014-07-20 05:57:55 Re: BUG #10989: log_statement = ddl does not log ddl statements from stored functions