A slightly misleading comment in GetNewObjectId()

From: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: A slightly misleading comment in GetNewObjectId()
Date: 2018-08-16 04:31:29
Message-ID: CAEepm=33JASACeOayr_W3=CSjy2jiPxM-k89axu0akFbHdjnjA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

While contemplating plans to use new kinds of OIDs in buffer tags, I
noticed $SUBJECT. It says:

* Check for wraparound of the OID counter. We *must* not return 0
* (InvalidOid); and as long as we have to check that, it seems a good
* idea to skip over everything below FirstNormalObjectId too. (This
* basically just avoids lots of collisions with bootstrap-assigned OIDs
* right after a wrap occurs, so as to avoid a possibly large number of
* iterations in GetNewOid.) Note we are relying on unsigned comparison.

That makes it sound like a mere optimisation, but since commit
8e18d04d4da user-created objects are not allowed to have OIDs below
that threshold. So I propose the attached tweak.

--
Thomas Munro
http://www.enterprisedb.com

Attachment Content-Type Size
0001-Improve-comment-in-GetNewObjectId.patch application/octet-stream 1.7 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Shinoda, Noriyoshi (PN Japan GCS Delivery) 2018-08-16 04:36:11 RE: Update comment in errcodes.txt correctly
Previous Message Tom Lane 2018-08-16 04:27:17 Re: Facility for detecting insecure object naming