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

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: 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-06-24 20:13:46
Message-ID: 20140624201346.GB17110@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Jun 20, 2014 at 02:07:25PM -0400, Bruce Momjian wrote:
> On Thu, Jun 19, 2014 at 09:06:54PM -0400, Alvaro Herrera wrote:
> > Alvaro Herrera wrote:
> > > Bruce Momjian wrote:
> >
> > > Bruce Momjian wrote:
> > >
> > > > > OK, so the xid has to be beyond 2^31 during pg_upgrade to trigger a
> > > > > problem? That might explain the rare reporting of this bug. What would
> > > > > the test query look like so we can tell people when to remove the '0000'
> > > > > files? Would we need to see the existence of '0000' and high-numbered
> > > > > files? How high? What does a 2^31 file look like?
> > > >
> > > > Also, what would a legitimate 0000 file at wrap-around time look like?
> > > > Would there have to be an 'ffff' or 'ffffff' file?
> > >
> > > Since I was wrong, there is no point in further research here. Anyway
> > > the last file before wrapping around in pg_multixact/members is FFFF.
> >
> > Oops, I meant the last file before wrap in pg_multixact/offsets is FFFF,
> > which is what we're talking about in this thread.
> >
> > For members it's 14078, but it's not relevant here.
>
> OK, so the next questions is, what will the minor-release-note query we
> give users to test this look like? Do we expect no gaps in numbering?
> Is it enough to test for the existance of '0000' and lack of '0001' and
> 'FFFF'? Basically, if we expect no gaps in normal numbering, then a
> '0000' with no number after it and no wrap-around number before it means
> the '0000' is left over from initdb and can be removed.

Assuming this is true, here is a query we can put in the next 9.3 minor
release notes to tell users if they need to remove the '0000' file:

WITH list(file) AS
(
SELECT * FROM pg_ls_dir('pg_multixact/offsets')
)
SELECT EXISTS (SELECT * FROM list WHERE file = '0000') AND
NOT EXISTS (SELECT * FROM list WHERE file = '0001') AND
NOT EXISTS (SELECT * FROM list WHERE file = 'FFFF') AND
EXISTS (SELECT * FROM list WHERE file != '0000')
AS file_removal_needed;

Do they need to remove the members/0000 file too?

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2014-06-25 00:01:00 Re: [HACKERS] BUG #10728: json_to_recordset with nested json objects NULLs columns
Previous Message Bruce Momjian 2014-06-24 20:11:45 Re: pg_upgrade < 9.3 -> >=9.3 misses a step around multixacts