public inbox for [email protected]  
help / color / mirror / Atom feed
From: Michael Paquier <[email protected]>
To: Aleksander Alekseev <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: [PATCH] Refactor SLRU to always use long file names
Date: Fri, 8 Nov 2024 13:21:08 +0900
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAJ7c6TNs8RY4Yvng4m375mAvsS4wHeUcqR8t4b2_i2j=PE6iNQ@mail.gmail.com>
References: <CAJ7c6TOy7fUW9MuNeOWor3cSFnQg9tgz=mjXHDb94GORtM_Eyg@mail.gmail.com>
	<[email protected]>
	<CAJ7c6TNs8RY4Yvng4m375mAvsS4wHeUcqR8t4b2_i2j=PE6iNQ@mail.gmail.com>

On Thu, Sep 12, 2024 at 12:33:14PM +0300, Aleksander Alekseev wrote:
> It wouldn't hurt re-checking the segment file names in the TAP test
> but this would mean hardcoding catalog names which as I understand you
> want to avoid. With high probability PG wouldn't start if the
> corresponding piece of pg_upgrade is wrong (I checked more than once
> :). So I'm not entirely sure if it's worth the effort, but let's see
> what others think.

+        segno = strtoi64(de->d_name, NULL, 16);
+        snprintf(new_path, MAXPGPATH, "%s/%015llX", dir_path,
+                    (long long) segno);
+        snprintf(old_path, MAXPGPATH, "%s/%s", dir_path, de->d_name);
+
+        if (pg_mv_file(old_path, new_path) != 0)
+            pg_fatal("could not rename file \"%s\" to \"%s\": %m",
+                     old_path, new_path);

Your patch is just doing a rename() of the files from short to long
names.  How about adding a new TAP script in pg_upgrade that creates a
couple of empty files with short files names in each path that needs
to do the transfer?  Then the test could run one pg_upgrade command
and check that the new names are in place.  You could use a array of
objects, with the base path, the old name and the new name, then loop
over it.  With the check in check_slru_segment_filenames() based on
SLRU_SEG_FILENAMES_CHANGE_CAT_VER, that should work.

+	static const char* dirs[] = {
+		"pg_xact",
+		"pg_commit_ts",
+		"pg_multixact/offsets",
+		"pg_multixact/members",
+		"pg_subtrans",
+		"pg_serial",
+	};

Hardcoding that is always annoying, but well, that's not going to
change.  So living with this is not going to be a maintenance burden.
--
Michael


Attachments:

  [application/pgp-signature] signature.asc (833B, 2-signature.asc)
  download

view thread (7+ messages)  latest in thread

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: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: [PATCH] Refactor SLRU to always use long file names
  In-Reply-To: <[email protected]>

* 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