agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Widen Object ID counter to 8 bytes
Date: Thu, 10 Sep 2026 00:43:36 +0000
Message-ID: <E1x4St5-00000004Cdl-1zsh@gemulon.postgresql.org> (raw)

Widen Object ID counter to 8 bytes

This commit adds a new routine called GetNewObjectId8() in varsup.c,
which is able to retrieve a 8-byte OID, based on the next OID retrieved
from the control file.  GetNewObjectId() is kept compatible with its
origin, where we still check that the lower 32 bits of the counter do
not wraparound, while handling the FirstNormalObjectId case.

This change is combined with an update of the control file, with
CheckPoint.nextOid enlarged from Oid to Oid8.  pg_control_checkpoint(),
pg_resetwal and pg_upgrade are updated to adapt to this change, to make
sure that the value is not truncated due to 32-bit limitations when
used, making an upgrade to a newer version where 8-byte is supported a
transparent operation.

A couple of comments in the xlog redo logic referred to wraparound
issues, which is not the case anymore with this change in place, so
refresh these.

This change is required to be able to support external TOAST pointers
based on Oid8, under discussion, and can be used for other purposes.

Tests are added for pg_upgrade (2^32 value carried across upgrades),
pg_resetwal and pg_control_checkpoint(), hence across all the tools
that need to be covered by this change.

Bump catalog version.
Bump PG_CONTROL_VERSION.
Bump XLOG_PAGE_MAGIC, due to XLOG_NEXTOID.

Author: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Greg Burd <greg@burd.me>
Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Reviewed-by: Yugo Nagata <nagata@sraoss.co.jp>
Discussion: https://postgr.es/m/af19kUjwjhaoUTLn@paquier.xyz

Branch
------
master

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

Modified Files
--------------
doc/src/sgml/func/func-info.sgml          |  2 +-
doc/src/sgml/ref/pg_resetwal.sgml         | 10 +++---
src/backend/access/rmgrdesc/xlogdesc.c    |  8 ++---
src/backend/access/transam/varsup.c       | 59 +++++++++++++++++++++----------
src/backend/access/transam/xlog.c         | 26 +++++++-------
src/backend/access/transam/xlogrecovery.c |  2 +-
src/backend/utils/misc/pg_controldata.c   |  2 +-
src/bin/pg_controldata/pg_controldata.c   |  2 +-
src/bin/pg_resetwal/pg_resetwal.c         | 10 +++---
src/bin/pg_resetwal/t/001_basic.pl        | 17 +++++++++
src/bin/pg_upgrade/controldata.c          |  2 +-
src/bin/pg_upgrade/pg_upgrade.c           |  2 +-
src/bin/pg_upgrade/pg_upgrade.h           |  2 +-
src/bin/pg_upgrade/t/002_pg_upgrade.pl    | 25 +++++++++++++
src/include/access/transam.h              |  8 +++--
src/include/access/xlog.h                 |  2 +-
src/include/access/xlog_internal.h        |  2 +-
src/include/catalog/catversion.h          |  2 +-
src/include/catalog/pg_control.h          |  4 +--
src/include/catalog/pg_proc.dat           |  2 +-
20 files changed, 129 insertions(+), 60 deletions(-)



Message-ID: <E1x4St5-00000004Cdl-1zsh@gemulon.postgresql.org>
Permalink:  ../E1x4St5-00000004Cdl-1zsh@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1x4St5-00000004Cdl-1zsh@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Widen Object ID counter to 8 bytes
  In-Reply-To: <E1x4St5-00000004Cdl-1zsh@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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox