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 1rhwwh-00EElo-I9 for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Mar 2024 19:28:55 +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 1rhwwf-00DRbz-45 for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Mar 2024 19:28:53 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rhwwe-00DRbq-QO for pgsql-hackers@lists.postgresql.org; Wed, 06 Mar 2024 19:28:53 +0000 Received: from tamriel.snowman.net ([2001:470:e38f::11]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rhwwb-003BhD-Mz for pgsql-hackers@lists.postgresql.org; Wed, 06 Mar 2024 19:28:52 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id CB7945F7B7; Wed, 6 Mar 2024 14:28:44 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=snowman.net; s=dkim; t=1709753324; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=nScASjZxT+935mbCY2maqmD0gvLZ+EM7oiUKYwPvO2E=; b=ucN9UsAHlnwPfysVNZOFw9VncFropTFDF9jDRzsYDVNqUeKx9mVNqI1X70OQ+HwINrWEY2 mfZmaG/cYQB3OmHceq4WpqZ7+RyT/NTF4FzuDdIYORMfA/aei6V3l1WD5e0CBq5Yr6uCrp 8Ye7/MTD449r36uj8Ghx7zcWdvybQbY= Date: Wed, 6 Mar 2024 14:28:44 -0500 From: Stephen Frost To: Ronan Dunklau Cc: pgsql-hackers@lists.postgresql.org Subject: Re: Provide a pg_truncate_freespacemap function Message-ID: References: <5446938.Sb9uPGUboI@aivenlaptop> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ll0PmT9CXpRJ2sg4" Content-Disposition: inline In-Reply-To: <5446938.Sb9uPGUboI@aivenlaptop> User-Agent: Mutt/2.1.4 (2021-12-11) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --ll0PmT9CXpRJ2sg4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Greetings, * Ronan Dunklau (ronan.dunklau@aiven.io) wrote: > As we are currently experiencing a FSM corruption issue [1], we need to= =20 > rebuild FSM when we detect it.=20 Ideally, we'd figure out a way to pick up on this and address it without the user needing to intervene, however ... > I noticed we have something to truncate a visibility map, but nothing for= the=20 > freespace map, so I propose the attached (liberally copied from the VM=20 > counterpart) to allow to truncate a FSM without incurring downtime, as=20 > currently our only options are to either VACUUM FULL the table or stop th= e=20 > cluster and remove the FSM manually. I agree that this would generally be a useful thing to have. > Does that seem correct ? Definitely needs to have a 'REVOKE ALL ON FUNCTION' at the end of the upgrade script, similar to what you'll find at the bottom of pg_visibility--1.1.sql in the tree today, otherwise anyone could run it. Beyond that, I'd suggest a function-level comment above the definition of the function itself (which is where we tend to put those- not at the point where we declare the function). Thanks! Stephen --ll0PmT9CXpRJ2sg4 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEwf6gbxKhD863zrx/7WyKOINHZFUFAmXow+kACgkQ7WyKOINH ZFVG1RAAvo61E41C6nmEgZacGhs1kSaS7sz/BDdsM9ieAx3aVedDiJopnLgi/xmx R7EKdwwEBiucRF/i7J/wTwCxqUFKQmYiy/9jfgSwZlnQaUFpTKUYtkq2kAbmtgC7 qrM0u73zF3nUcbuyk1lOLP9NltTpylSFpa9K2DOmcIORQ25MbFCHelQDDi5o40RE AUw7RaevE31FGftZ4TTSdivkQHbQA4/3x758lhTmkHj3K9SdDwWM4z0jW8Zt6ITD CPXi/iPHiIqdVtam1AwIZHmax007opz+X9Xl3seG11fGEnB9VZ/Dqu/cMAs+Fw9b rIOAYl2WfWPL4Q0aqr1vdin71lRp8ejW5DPO1UgrYaimefszETdt9aA56d4oYyKw itgFngfIAPXSALYpLSSiva8v97LGX0z4jRRi37g2udC2803SQY2dBhxA6E0E/3hR 135+Y6MnTjDeWnZcV8YFlFgbQ3I1VzmaNwVGCSQjNeh6iHNyRgDqHmttFCpU4TrZ tunpLlRbBA/YjT/jdbj7NsPx56JV71DaK4jja4OVy2fXaCnxBYIEHl9Mo+gI9met 6Xz1YYERkB3mivIu5tnsuHYPGcM2ZIl26EP1h213qfRDcsUsSzGPplhIiEwX4Zc4 6g5OvtyqjwI5C1j3CdEzzOGS91lXDm479R3Fi1XXExaNPIg9PJw= =51pW -----END PGP SIGNATURE----- --ll0PmT9CXpRJ2sg4--