pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Create a script that can renumber manually-assigned OIDs.
Date: Tue, 12 Mar 2019 16:30:48 +0000
Message-ID: <E1h3kIi-0005Ey-DO@gemulon.postgresql.org> (raw)

Create a script that can renumber manually-assigned OIDs.

This commit adds a Perl script renumber_oids.pl, which can reassign a
range of manually-assigned OIDs to someplace else by modifying OID
fields of the catalog *.dat files and OID-assigning macros in the
catalog *.h files.

Up to now, we've encouraged new patches that need manually-assigned
OIDs to use OIDs just above the range of existing OIDs.  Predictably,
this leads to patches stepping on each others' toes, as whichever
one gets committed first creates an OID conflict that other patch
author(s) have to resolve manually.  With the availability of
renumber_oids.pl, we can eliminate a lot of this hassle.
The new project policy, therefore, is:

* Encourage new patches to use high OIDs (the documentation suggests
choosing a block of OIDs at random in 8000..9999).

* After feature freeze in each development cycle, run renumber_oids.pl
to move all such OIDs down to lower numbers, thus freeing the high OID
range for the next development cycle.

This plan should greatly reduce the risk of OID collisions between
concurrently-developed patches.  Also, if such a collision happens
anyway, we have the option to resolve it without much effort by doing
an off-schedule OID renumbering to get the first-committed patch out
of the way.  Or a patch author could use renumber_oids.pl to change
their patch's assignments without much pain.

This approach does put a premium on not hard-wiring any OID values
in places where renumber_oids.pl and genbki.pl can't fix them.
Project practice in that respect seems to be pretty good already,
but a follow-on patch will sand down some rough edges.

John Naylor and Tom Lane, per an idea of Peter Geoghegan's

Discussion: https://postgr.es/m/CAH2-WzmMTGMcPuph4OvsO7Ykut0AOCF_i-=eaochT0dd2BN9CQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a6417078c4140e51cfd717448430f274b449d687

Modified Files
--------------
doc/src/sgml/bki.sgml                |  40 ++++-
src/backend/catalog/Catalog.pm       |   2 +
src/include/catalog/indexing.h       |   3 +
src/include/catalog/renumber_oids.pl | 291 +++++++++++++++++++++++++++++++++++
src/include/catalog/toasting.h       |   3 +
src/tools/RELEASE_CHANGES            |  16 +-
6 files changed, 350 insertions(+), 5 deletions(-)



Message-ID: <E1h3kIi-0005Ey-DO@gemulon.postgresql.org>
Permalink:  ../E1h3kIi-0005Ey-DO@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1h3kIi-0005Ey-DO@gemulon.postgresql.org

 · 

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-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Create a script that can renumber manually-assigned OIDs.
  In-Reply-To: <E1h3kIi-0005Ey-DO@gemulon.postgresql.org>
  References: <E1h3kIi-0005Ey-DO@gemulon.postgresql.org>

* 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