pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Refactor parse_filename_for_nontemp_relation to parse more.
Date: Mon, 23 Oct 2023 19:17:02 +0000
Message-ID: <E1qv0QA-0020U9-FV@gemulon.postgresql.org> (raw)

Refactor parse_filename_for_nontemp_relation to parse more.

Instead of returning the number of characters in the RelFileNumber,
return the RelFileNumber itself. Continue to return the fork number,
as before, and additionally return the segment number.

parse_filename_for_nontemp_relation now rejects a RelFileNumber or
segment number that begins with a leading zero. Before, we accepted
such cases as relation filenames, but if we continued to do so after
this change, the function might return the same values for two
different files (e.g. 1234.5 and 001234.5 or 1234.005) which could be
annoying for callers. Since we don't actually ever generate filenames
with leading zeroes in the names, any such files that we find must
have been created by something other than PostgreSQL, and it is
therefore reasonable to treat them as non-relation files.

Along the way, change unlogged_relation_entry to store a RelFileNumber
rather than an OID. This update should have been made in
851f4cc75cdd8c831f1baa9a7abf8c8248b65890, but it was overlooked.
It's trivial to make the update as part of this commit, perhaps more
trivial than it would have been without it, so do that.

Patch by me, reviewed by David Steele.

Discussion: http://postgr.es/m/CA+TgmoZNVeBzoqDL8xvr-nkaepq815jtDR4nJzPew7=3iEuM1g@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5c47c6546c413d5eb51c1626070a807026e6139d

Modified Files
--------------
src/backend/backup/basebackup.c   |  15 ++---
src/backend/storage/file/reinit.c | 137 +++++++++++++++++++++++---------------
src/include/storage/reinit.h      |   5 +-
3 files changed, 93 insertions(+), 64 deletions(-)



Message-ID: <E1qv0QA-0020U9-FV@gemulon.postgresql.org>
Permalink:  ../E1qv0QA-0020U9-FV@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1qv0QA-0020U9-FV@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: rhaas@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Refactor parse_filename_for_nontemp_relation to parse more.
  In-Reply-To: <E1qv0QA-0020U9-FV@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