pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Upgrade BufFile to use int64 for byte positions
Date: Thu, 25 Dec 2025 23:42:51 +0000
Message-ID: <E1vYuyo-002hn9-2O@gemulon.postgresql.org> (raw)

Upgrade BufFile to use int64 for byte positions

This change has the advantage of removing some weird type casts, caused
by offset calculations based on pgoff_t but saved as int (on older
branches we use off_t, which could be 4 or 8 bytes depending on the
environment).  These are safe currently because capped by
MAX_PHYSICAL_FILESIZE, but we would run into problems when to make
MAX_PHYSICAL_FILESIZE larger or allow callers of these routines to use a
larger physical max size on demand.

While on it, this improves BufFileDumpBuffer() so as we do not use an
offset for "availbytes".  It is not a file offset per-set, but a number
of available bytes.

This change should lead to no functional changes.

Author: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/aUStrqoOCDRFAq1M@paquier.xyz

Branch
------
master

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

Modified Files
--------------
src/backend/storage/file/buffile.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)



Message-ID: <E1vYuyo-002hn9-2O@gemulon.postgresql.org>
Permalink:  ../E1vYuyo-002hn9-2O@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1vYuyo-002hn9-2O@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: Upgrade BufFile to use int64 for byte positions
  In-Reply-To: <E1vYuyo-002hn9-2O@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