pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Shruthi Gowda <gowdashru@gmail.com>
Cc: Julien Rouhaud <rjuju123@gmail.com>
Cc: Sadhuprasad Patro <b.sadhu@gmail.com>
Cc: Stephen Frost <sfrost@snowman.net>
Cc: Bruce Momjian <bruce@momjian.us>
Cc: Andres Freund <andres@anarazel.de>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: Tom Kincaid <tomjohnkincaid@gmail.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>
Cc: Thomas Munro <thomas.munro@gmail.com>
Cc: PostgreSQL Development <pgsql-hackers@postgresql.org>
Cc: Masahiko Sawada <masahiko.sawada@2ndquadrant.com>
Subject: Re: preserving db/ts/relfilenode OIDs across pg_upgrade (was Re: storing an explicit nonce)
Date: Wed, 20 Apr 2022 16:56:22 -0400
Message-ID: <2996609.1650488182@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+TgmoaGZVFR=qdtUM-M6=pRn_Dg4qgprZt36R_TrbATZNQdkA@mail.gmail.com>
References: <CA+TgmoZtbAnybMwni-u-9LArqYhsvpeF48itsJP=otrvE_ZzSQ@mail.gmail.com>
	<CAASxf_Mj3SSXFmtd9O6sf-+y4PJz+oZ57RAi0bRKKLAOBDcorA@mail.gmail.com>
	<CA+TgmoZhgeXfrT5zOUkVisPQ-cuYRg2M9MBG7WrE0sgcUKQVWg@mail.gmail.com>
	<CAASxf_P+EFr++8Vmfjb88HMEcCRS6NbXXQhFath0oXLnoHwJSA@mail.gmail.com>
	<CA+TgmoZ9ee+RHdFXvJ9obHfwJvpxRMN=dxrJNWoktc+QBj=XVw@mail.gmail.com>
	<CAASxf_Nzsprv-JxO=8QDzK226iYMu0fspgRD4RoYQ=ddcO0Xqw@mail.gmail.com>
	<CAFF0-CEPkpnc+SbPxqm0Q6A6cKjmNN+PndYf21+T+gQtiM0BGg@mail.gmail.com>
	<CA+TgmoYbCSQzwBsn-33Pk=Y34uovR_bt9dVrZVMX0jHgZMWG1A@mail.gmail.com>
	<CAASxf_Pqp44ERghe3JkiDoxNhf7DCDg-=emq1ZV3TVKTKajLmA@mail.gmail.com>
	<CAASxf_Nmjh-Do92L6RXjjYGMnUZKx7RK1D266xRWhKjPA_7Egw@mail.gmail.com>
	<20220115054719.yeqoy2mdllbc7wq2@jrouhaud>
	<CAASxf_OL+GtnnfHJ6-KtgHFFskv_btd5_wn_B39HvOyQTMXNBw@mail.gmail.com>
	<CA+TgmoaOFR=3eWScWrDDw0m9u-a+CaFXrZNwgnJfo7g9_mP_nA@mail.gmail.com>
	<CAASxf_O4+cZeGb=W98=WEp0R=d+=Um7PM=8h7Ec-qZ=tJR1EEQ@mail.gmail.com>
	<CAASxf_Oj8cSJonwsWMtGyUTkK-EhmygW0HG! TSXb1jCq_beAwkQ@mail.gmail.com>
	<CA+TgmoaHQqzeGE++XoxqLnHbwT2pSnB=Ci9qsWyfgwfdpBkXdg@mail.gmail.com>
	<CAASxf_Oo38X3GyxHbpjRc=b9WEwZMsA3hsZx-YQwqMkwH84_ig@mail.gmail.com>
	<CA+TgmoYpSWZoLLf94RwZro-QYtrUkDX-_U4VbT0rpCZsObgR3w@mail.gmail.com>
	<CAASxf_Mnwm1Dh2vd5FAhVX6S1nwNSZUB1z12VddYtM++H2+p7w@mail.gmail.com>
	<CA+Tgmoacutrt_QRFPXs2r64kizynW2dP0KUdkQRFrbDwB_Yzug@mail.gmail.com>
	<2935358.1650479692@sss.pgh.pa.us>
	<CA+TgmoaGZVFR=qdtUM-M6=pRn_Dg4qgprZt36R_TrbATZNQdkA@mail.gmail.com>

Robert Haas <robertmhaas@gmail.com> writes:
> On Wed, Apr 20, 2022 at 2:34 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> The attached draft patch attempts to improve this situation.
>> It reserves these OIDs, and creates the associated macros, through
>> the normal BKI infrastructure by adding entries in pg_database.dat.
>> We have to delete those rows again during initdb, which is slightly
>> ugly but surely no more so than initdb's other direct manipulations
>> of pg_database.

> I'm not sure I really like this approach, but if you're firmly
> convinced that it's better than cleaning up the loose ends in some
> other way, I'm not going to waste a lot of energy fighting about it.

Having just had to bury my nose in renumber_oids.pl, I thought of a
different approach we could take to expose these OIDs to Catalog.pm.
That's to invent a new macro that Catalog.pm recognizes, and write
something about like this in pg_database.h:

DECLARE_OID_DEFINING_MACRO(Template0ObjectId, 4);
DECLARE_OID_DEFINING_MACRO(PostgresObjectId, 5);

That would result in (a) the OIDs becoming known to Catalog.pm
as reserved, though it wouldn't have any great clue about their
semantics; and (b) this getting emitted into pg_database_d.h:

#define Template0ObjectId 4
#define PostgresObjectId 5

Then we'd not need the dummy entries in pg_database.dat, which
does seem cleaner now that I think about it.  A downside is that
with no context, Catalog.pm could not provide name translation
services during postgres.bki generation for such OIDs --- but
at least for these entries, we don't need that.

If that seems more plausible to you I'll set about preparing a patch.

			regards, tom lane





view thread (90+ messages)  latest in thread

Message-ID: <2996609.1650488182@sss.pgh.pa.us>
Permalink:  ../2996609.1650488182@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2996609.1650488182@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, robertmhaas@gmail.com, gowdashru@gmail.com, rjuju123@gmail.com, b.sadhu@gmail.com, sfrost@snowman.net, bruce@momjian.us, andres@anarazel.de, alvherre@alvh.no-ip.org, sawada.mshk@gmail.com, tomjohnkincaid@gmail.com, amit.kapila16@gmail.com, thomas.munro@gmail.com, masahiko.sawada@2ndquadrant.com
  Subject: Re: preserving db/ts/relfilenode OIDs across pg_upgrade (was Re: storing an explicit nonce)
  In-Reply-To: <2996609.1650488182@sss.pgh.pa.us>
  References: <CA+TgmoZtbAnybMwni-u-9LArqYhsvpeF48itsJP=otrvE_ZzSQ@mail.gmail.com> <CAASxf_Pqp44ERghe3JkiDoxNhf7DCDg-=emq1ZV3TVKTKajLmA@mail.gmail.com> <CAASxf_Nmjh-Do92L6RXjjYGMnUZKx7RK1D266xRWhKjPA_7Egw@mail.gmail.com> <20220115054719.yeqoy2mdllbc7wq2@jrouhaud> <CAASxf_OL+GtnnfHJ6-KtgHFFskv_btd5_wn_B39HvOyQTMXNBw@mail.gmail.com> <CA+TgmoaOFR=3eWScWrDDw0m9u-a+CaFXrZNwgnJfo7g9_mP_nA@mail.gmail.com> <CAASxf_O4+cZeGb=W98=WEp0R=d+=Um7PM=8h7Ec-qZ=tJR1EEQ@mail.gmail.com> <CA+TgmoaHQqzeGE++XoxqLnHbwT2pSnB=Ci9qsWyfgwfdpBkXdg@mail.gmail.com> <CAASxf_Oo38X3GyxHbpjRc=b9WEwZMsA3hsZx-YQwqMkwH84_ig@mail.gmail.com> <CA+TgmoYpSWZoLLf94RwZro-QYtrUkDX-_U4VbT0rpCZsObgR3w@mail.gmail.com> <CAASxf_Mnwm1Dh2vd5FAhVX6S1nwNSZUB1z12VddYtM++H2+p7w@mail.gmail.com> <CA+Tgmoacutrt_QRFPXs2r64kizynW2dP0KUdkQRFrbDwB_Yzug@mail.gmail.com> <2935358.1650479692@sss.pgh.pa.us> <CA+TgmoaGZVFR=qdtUM-M6=pRn_Dg4qgprZt36R_TrbATZNQdkA@mail.gmail.com> <2996609.1650488182@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox