Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t9GUy-008nJ8-Qc for pgsql-hackers@arkaria.postgresql.org; Fri, 08 Nov 2024 04:21:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1t9GUv-005oFZ-MB for pgsql-hackers@arkaria.postgresql.org; Fri, 08 Nov 2024 04:21:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t9GUv-005oFR-CS for pgsql-hackers@lists.postgresql.org; Fri, 08 Nov 2024 04:21:25 +0000 Received: from fout-b5-smtp.messagingengine.com ([202.12.124.148]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t9GUs-000mvV-0Z for pgsql-hackers@lists.postgresql.org; Fri, 08 Nov 2024 04:21:25 +0000 Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id 4CEAF11401A3; Thu, 7 Nov 2024 23:21:20 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Thu, 07 Nov 2024 23:21:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1731039680; x=1731126080; bh=fsHHrT18u8 dqqS03svUSTU9H91FwCwAuKG1LNm0HfeY=; b=aDw0ol1pYxWaeA1wnrQqhXhyY0 rANuKcDZyfcJLzV8v6vLRQwEHU3SSrkAehBj2s9kmYrp1Uafs2zLZMY9/vp7xK2d Cxt2y05DnxtatlSij6ikF02DwA6YGg867mCS9dGwchup2uIBPIVUOLbk7y/emPXC tvfwq29xzY9e817wJ7IMVf1vn40IaCMJV1LQUAiAtbP/j4WVffJ3vYg8NuIl8DMn nDrN9nt0eAkXBI8RgM0wIHB89QN8cV1GRp0Tr7+v2ZYADEoZQqNeqJN+UCN+6/Uf 7aAdzBoQYOS6thYqiM4MVs4keNt50ZKWsY73IPgt8n5yHYot59wwTLUS4ZTQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1731039680; x=1731126080; bh=fsHHrT18u8dqqS03svUSTU9H91FwCwAuKG1 LNm0HfeY=; b=DVxn6wgBIUokkk8/2vaz5hF/d9COjq1Ij11KsqLB1rIcv93lFqW myDY7FaYP8PTRAl6hV53QHf7q35+sluGNxFCmUtBMOJ2WAmEU8YPd/SVi2rB2X0T IQhMTtknEF6AC1aZ4YWs9ZKLTH4RVgoBsD/rTC3L4kpx5hPSOgEa8fvMCPLHhkUW L+RjAS+ckeEjCxzBjHgxZxC3vh7QSJb3yjYVgSSacwfEBHYA40xkviaLZ6+B3fJ6 JK8wMWrfl/s7uAY+TM00dNdXhl44+5RAkBuP0IRVtfIszOGuUYDUE4t2NKFqYPQT irlaQd9lP9sO3nV3YYWUMMNt+Z0fUBe/D/Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrtdehgdeilecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnth hsucdlqddutddtmdenfghrlhcuvffnffculdejtddmnecujfgurhepfffhvfevuffkfhgg tggujgesghdtreertddtvdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoe hmihgthhgrvghlsehprghquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpeetleei fedufffhhfdtteelgeeggeffhfekueevteeigfduudevudetgfegiedvjeenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehp rghquhhivghrrdighiiipdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuth dprhgtphhtthhopegrlhgvkhhsrghnuggvrhesthhimhgvshgtrghlvgdrtghomhdprhgt phhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehlihhsthhsrdhpohhsthhgrhgvshhqlh drohhrgh X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 7 Nov 2024 23:21:18 -0500 (EST) Date: Fri, 8 Nov 2024 13:21:08 +0900 From: Michael Paquier To: Aleksander Alekseev Cc: PostgreSQL Hackers Subject: Re: [PATCH] Refactor SLRU to always use long file names Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="tFBNSxGKvnxzwgES" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --tFBNSxGKvnxzwgES Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --tFBNSxGKvnxzwgES Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmctkbQACgkQnvQgOdby QH2dMQ/+J3JYJDnopkt0fiVbMFYjqqK0zc5589ury95j2CbPWBKAwyspbJDTg5++ lTh0OMHT4sY3Kc2MpF6I3svrFRu1oWFsO8mVQ2EISZQuKHdtK1hnYTNUbsYbIzrz 7NiKC+H/a3NbImJ51P60LNzRXhdgd6e9SAptGmnjEhJNGlDpDtnNFynCnoYdlj0v xPr4N4bXt5QA1xvqhGflyy8XCGJUkvvDP2SMGeGmUvxjvzcqjiNj+pZJEFLycCPW eKzF1J+3qEK0qcaoc/q49Y3X84R0IKbJkxexQQGEpV7o109EYnV7csS2B4Rkb4W0 ZD4pbmilj5CYOpBK3oXiVcKcY4JQH9dY2rfZraj56YvTYhur4ZgHwQZNcTGgGPbt qk+4lAPN0T6ufpc+w4YUK6Ekmf2eHwe/HlOAyp6ONIPea3HNFAKdH7V28deh3/Df cmP8lV6VP2zde/QxBBNfG5FoI+rXNnx8rxgFmk+S8oEoBZRZ8rb/sT/GruP5Y8o9 eWjd9GV+lYTPRJwI4HQBMrKIbius3dZsb9q7kL8ewpkHAWfBUjExwz+Y1rAu8TJF bwfO4jC4tcbotN9masWkPPB19MuiHrSwXfDIj8apRWlsfaXa3cUQ+jY2Gxeptuip +E6Uoq9zvQ8UF1+g2NHy0IGK7/22hq30aXO+pTKNqG6VDLpuwLw= =WSsa -----END PGP SIGNATURE----- --tFBNSxGKvnxzwgES--