Reducing the range of OIDs consumed by genbki.pl

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
Subject: Reducing the range of OIDs consumed by genbki.pl
Date: 2021-05-26 21:43:02
Message-ID: 1665197.1622065382@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The attached patch stems from the conversation at [1];
I'm starting a new thread to avoid confusing the cfbot.

Briefly, the idea is to allow reverting the change made in
commit ab596105b to increase FirstBootstrapObjectId from
12000 to 13000, by teaching genbki.pl to assign OIDs
independently in each catalog rather than from a single
OID counter. Thus, the OIDs in this range will not be
globally unique anymore, but only unique per-catalog.

The aforesaid commit had to increase FirstBootstrapObjectId
because as of HEAD, genbki.pl needs to consume OIDs up through
12035, overrunning the old limit of 12000. But moving up that
limit seems a bit risky, cf [2]. It'd be better if we could
avoid doing that. Since the OIDs in question are spread across
several catalogs, allocating them per-catalog seems to fix the
problem quite effectively. With the attached patch, the ending
OID counters are

GenbkiNextOid(pg_amop) = 10945
GenbkiNextOid(pg_amproc) = 10697
GenbkiNextOid(pg_cast) = 10230
GenbkiNextOid(pg_opclass) = 10164

so we have quite a lot of daylight before we'll ever approach
12000 again.

Per-catalog OID uniqueness shouldn't be a problem here, because
any code that's assuming global uniqueness is broken anyway;
no such guarantee exists after the OID counter has wrapped
around.

So I propose shoehorning this into v14, to avoid shipping a
release where FirstBootstrapObjectId has been bumped up.

regards, tom lane

[1] https://www.postgresql.org/message-id/flat/3737988.1618451008%40sss.pgh.pa.us

[2] https://www.postgresql.org/message-id/flat/CAGPqQf3JYTrTB1E1fu_zOGj%2BrG_kwTfa3UcUYPfNZL9o1bcYNw%40mail.gmail.com

Attachment Content-Type Size
change-genbki-oid-allocation.patch text/x-diff 5.0 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2021-05-26 22:08:20 Re: Move pg_attribute.attcompression to earlier in struct for reduced size?
Previous Message Alvaro Herrera 2021-05-26 21:35:30 Re: Incorrect usage of strtol, atoi for non-numeric junk inputs