Re: Transactional sequence stuff breaks pg_upgrade

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Transactional sequence stuff breaks pg_upgrade
Date: 2017-06-12 21:25:17
Message-ID: 20170612212517.j3xe6am7hlztl6fw@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2017-06-12 17:13:34 -0400, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> > On 2017-06-11 20:03:28 -0400, Tom Lane wrote:
> >> @@ -391,6 +391,13 @@ GetNewRelFileNode(Oid reltablespace, Rel
> >> bool collides;
> >> BackendId backend;
> >>
> >> + /*
> >> + * If we ever get here during pg_upgrade, there's something wrong; all
> >> + * relfilenode assignments during a binary-upgrade run should be
> >> + * determined by commands in the dump script.
> >> + */
> >> + Assert(!IsBinaryUpgrade);
> >> +
>
> > I'm very doubtful that a) this doesn't get hit in practice, and b) that
> > we can rely on it going forward. At least until we change toasting to
> > not use the global oid counter.
>
> This is not about assignments from the global OID counter; the function
> it's touching is GetNewRelFileNode() not GetNewObjectId().

Ah, that makes more sense. You'd put the backtrace() into
GetNewObjectId() your original message, that's probably why I thought
about it.

> We don't care, for the most part. But we *do* care about relfilenode
> assignments, for precisely the reason seen in this bug.

Even there I don't think that's a sane assumption *for the future*. We
just need a slight change in the rules about when a toast table is needed
- and that stuff seriously need overhauling - and it doesn't work
anymore.

In my opinion the problem of:
> assignments of relfilenodes have to be shortcircuited by pg_upgrade
> override calls during a binary-restore run, or we risk filename
> collisions.

should instead be solved by simply not even trying to preserve
relfilenodes. We can "just" copy/link files to the the new
relfilenodes, there's no need to preserve them, in contrast to
pg_class.oid etc. But that's obviously something for the future.

> I intend to not only commit this, but back-patch it. There's enough
> changes in relevant code paths that logic that is fine in HEAD might
> not be fine in back branches.

Hm.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2017-06-12 21:32:15 Re: ICU support on Windows
Previous Message Andres Freund 2017-06-12 21:16:30 Re: Relpartbound, toasting and pg_class