Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nZkeV-0006FI-0Y for pgsql-hackers@arkaria.postgresql.org; Thu, 31 Mar 2022 02:35:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nZkeT-0008FX-Ac for pgsql-hackers@arkaria.postgresql.org; Thu, 31 Mar 2022 02:35:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nZkeS-0008Eu-J0 for pgsql-hackers@lists.postgresql.org; Thu, 31 Mar 2022 02:35:09 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nZkeN-0008B4-PJ for pgsql-hackers@lists.postgresql.org; Thu, 31 Mar 2022 02:35:08 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id E21C732021A2; Wed, 30 Mar 2022 22:34:59 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 30 Mar 2022 22:35:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm1; bh=T0XjAwZoC0TaLWxU4MjDDQ7Nl08cXHItss4c+6 lsTB0=; b=KA13nDqOwb9BgfNZZ7IBnp3tLV7esvE9aBpaigwpgrGX2QosMaQhLC awA9sM7oSVnTBXORBelURRVD160uzR1qUXiK++WMKjG5wwngg1R1zdJcIcqj10hn 2X/W6xWl/3bSEM3ULObHiArD3/VDDQ3+K9RcoITzt9MgVAXZJN5DoggJE44DLAld YDCBG47KacFP16cnefizDWeYrhpCONkCUNR1A+w//9XDMr/V5Y+WdT/zBVevK4Rt 8Gv9bjUY03EcQmj7heq7T4GXRlqEPEhHqqxH+S+JjNptan3K1ScdXvugLDp5G0Mh 8Bi2hQvUhSDV5BdBn7wkKlEdiVlV/BYg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=T0XjAwZoC0TaLWxU4 MjDDQ7Nl08cXHItss4c+6lsTB0=; b=A4IvmSYkTaxuUHxkBV60irpgLBu59EhZa 5w4LMkpQ1pFmd5U4VB/9qylCiCIIT5WqF5EVDdMhxyCrEnak0t7CsM7gHN8atPnM Lavx8OaWLrYG2Hn2W6s+FblX2NhrpIi3FPqDoAlUxikxjZig/nhApsaA1SHfG/uD 5bWO80lhVT4kXyJ3yHiNyaQG6f0CKU8X/JSz5S0ttFBACVPzvcqGUi5sQ5aO1pYj e5CZGvAy947vjAYws+5R2LUEU7eFhDxyzGFVhd2fUs936oQvDzx9O92ulW4A8poz S6kUp8mVIumoX5YNmYottbqkUlYzEy6bdUrN3su5hfj9axWG8kl2Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudeifedgheehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdlfeehmdenucfjughrpeffhffvuffkfhggtggujgesghdtreertddt vdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg hquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpedvgeduuefhtdeuleettdevjeeh heeiveeuieegleetgeeljeelieeuieehgeevhfenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiii X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 30 Mar 2022 22:34:57 -0400 (EDT) Date: Thu, 31 Mar 2022 11:34:52 +0900 From: Michael Paquier To: gkokolatos@pm.me Cc: Justin Pryzby , Rachel Heaton , Greg Stark , pgsql-hackers@lists.postgresql.org Subject: Re: Add LZ4 compression in pg_dump Message-ID: References: <20220325132253.GD28503@telsasoft.com> <20220326061441.GH28503@telsasoft.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="voBCY8jmdVbMDM1Q" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --voBCY8jmdVbMDM1Q Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Mar 30, 2022 at 03:32:55PM +0000, gkokolatos@pm.me wrote: > On Wednesday, March 30th, 2022 at 7:54 AM, Michael Paquier wrote: >> While moving on with 0002, I have noticed the following in >> >> _StartBlob(): >> if (AH->compression !=3D 0) >> sfx =3D ".gz"; >> else >> sfx =3D ""; >> >> Shouldn't this bit also be simplified, adding a fatal() like the other >> code paths, for safety? >=20 > Agreed. Fixed. Okay. 0002 looks fine as-is, and I don't mind the extra fatal() calls. These could be asserts but that's not a big deal one way or the other. And the cleanup is now applied. >> + my $compress_program =3D $ENV{GZIP_PROGRAM}; >> >> It seems to me that it is enough to rely on {compress_cmd}, hence >> there should be no need for $compress_program, no? >=20 > Maybe not. We don't want to the tests to fail if the utility is not > installed. That becomes even more evident as more methods are added. > However I realized that the presence of the environmental variable does > not guarrantee that the utility is actually installed. In the attached, > the existance of the utility is based on the return value of system_log(). Hmm. [.. thinks ..] The thing that's itching me here is that you align the concept of compression with gzip, but that's not going to be true once more compression options are added to pg_dump, and that would make $supports_compression and $compress_program_exists incorrect. Perhaps the right answer would be to rename all that with a suffix like "_gzip" to make a difference? Or would there be enough control with a value of "compression_gzip" instead of "compression" in test_key? +my $compress_program_exists =3D (system_log("$ENV{GZIP_PROGRAM}", '-h', + '>', '/dev/null') =3D=3D 0); Do we need this command execution at all? In all the other tests, we rely on a simple "if (!defined $gzip || $gzip eq '');", so we could do the same here. A last thing is that we should perhaps make a clear difference between the check that looks at if the code has been built with zlib and the check for the presence of GZIP_PROGRAM, as it can be useful in some environments to be able to run pg_dump built with zlib, even if the GZIP_PROGRAM command does not exist (I don't think this can be the case, but other tests are flexible). As of now, the patch relies on pg_dump enforcing uncompression if building under --without-zlib even if --compress/-Z is used, but that also means that those compression tests overlap with the existing tests in this case. Wouldn't it be more consistent to check after $supports_compression when executing the dump command for test_key =3D "compression[_gzip]"? This would mean keeping GZIP_PROGRAM as sole check when executing the compression command. -- Michael --voBCY8jmdVbMDM1Q Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmJFE0wACgkQnvQgOdby QH0Gvw/5ASSQ14n/wuwDU5IfV+mr14c4dTcwOVN5EDjTUbhAfET+BwM6E+MMnvi8 vHx6W0npbFGCiO+/RH5qtMbpdiLDIJQ1H5gHWXbQe4fDfcul/GuhkzR/kAT/4e8Y f06HymK8OD3hbpEZGFH0MrU2LBBzShixgDc7ClbuJ58rWfEIH8w0AJJZIP4p9g5g k6bJk2AD51kyIDWmdcXW7vJCRSqqtZWLPQiWBu8N9tM84TFaIB5+OcBI8lrkAjN2 Q29fqRii7k/bEg9blrHRcRVjjq33rVJp2kZlAHz1ufPqcMQB16fDM3jarPTI187s XNiIPBJE42UGxsaiynxMMF50BmhsP0BxpN1TQ120ICybclo9CMdEGEhT/C6kiF8B DzjtZPVg4Sn/jyp6Kk2XhH2oEUaePoQpGOJgfyP7Rxe0j1jzr3TagV2z3D8ZR2wC Mc/dcX3Ura9ktaF9j8BcRNVAnVAjdH40IU0XIgWRYJL0FjfBHrchHw57dm6xLHP9 kvnCLtvGjwRJaeWbQtG8C/KEg1RmI8lGez5CwKc9QNVfnhwDYlx+WS0EueG6gP4V vk5skRHCS3sHFtIkVw51qHa6vvW51pBbVx9pC0Ldu6zXiU0QwojOdc6z9GxJ1jKv 9LPtrhDyFJswyZNrfGtsYndaBzrReEGCHpnjmvn99AonKGjAaUA= =czu4 -----END PGP SIGNATURE----- --voBCY8jmdVbMDM1Q--