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 1nZRI7-0000al-Ic for pgsql-hackers@arkaria.postgresql.org; Wed, 30 Mar 2022 05:54:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nZRI6-0000p0-9j for pgsql-hackers@arkaria.postgresql.org; Wed, 30 Mar 2022 05:54:46 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nZRI4-0000oq-IP for pgsql-hackers@lists.postgresql.org; Wed, 30 Mar 2022 05:54:46 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nZRI1-0004kN-IX for pgsql-hackers@lists.postgresql.org; Wed, 30 Mar 2022 05:54:43 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 5F7275C014E; Wed, 30 Mar 2022 01:54:40 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 30 Mar 2022 01:54:40 -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=DAWwORiUCa9KWTT7XvDd5qm5l8FcwOR1N1bhn7 ivNlU=; b=LGOmihReDOSEnFzcXjNv8w0IEnDPg2piYQX/FGT76rzKxypLvp6B+p Xy9xMr7O2I2E5RWccfDlvBUGOhv/uGG98syW5Uzg3rfo5lPDooWEJnvIk9eW7yZX iDYoCwdjRRFPl0d4IwITfFPNeCiol5E0dhBIJURjQXMBQHNVd8szclTpSPG5Ot8y EK0FQ5yaduTmczE80xc/wSVfFvA1EwqsU/uZCYAvj0bfuoxIeuC22pQCenYyX7+6 EDGwxojYBvnrAHH1ogAltNN6fkCsnPQfcoWbobcPU+Z2RJtHpKQH3PhKWSX0XjGB 3v2jnkmLny2QegbaTCKbxl1KgnTX2TBw== 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=DAWwORiUCa9KWTT7X vDd5qm5l8FcwOR1N1bhn7ivNlU=; b=El9STLavQMavdeeyvZjoxT7U3aou/7XXg TKvTYESVi5vCavQX8qSSzUmLE/15gDGnjQg5xwxOme00aQeT/+MLlr8R3il8Fzgn Q4XdX1gqXTO1bZ2Y17J+1Exheuq8Luc+ZVKHzc8ThiJG+3hVXNMDjEz5j6VmjtFY /29LE2LEBquRTI8zWtm861nXddAxyoPbYqrp1ya2IOiL8jbxTEnk6u6pT482RJLx iEMGWkpVe5TENBhbrgTRTsyCY2mI1QrFWc1xCTiVWwEV2bS1DmYEJ9qpttGniCty 0mFHeZEeeQ+mEKluggrHm+o1ntmAmLO0Y/z3vSsqEApqbnCE3W4uQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudeiuddguddtudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enfghrlhcuvffnffculdefhedmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredt tddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepvdegudeuhfdtueeltedtveej heehieevueeigeelteegleejleeiueeiheegvefhnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiih ii X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 30 Mar 2022 01:54:38 -0400 (EDT) Date: Wed, 30 Mar 2022 14:54:34 +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: <20220304161039.GL27651@telsasoft.com> <20220325132253.GD28503@telsasoft.com> <20220326061441.GH28503@telsasoft.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="HScUv9d//ae60EaW" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --HScUv9d//ae60EaW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Mar 29, 2022 at 09:46:27AM +0000, gkokolatos@pm.me wrote: > On Tuesday, March 29th, 2022 at 9:27 AM, Michael Paquier wrote: >> On Sat, Mar 26, 2022 at 01:14:41AM -0500, Justin Pryzby wrote: >> Wow. This stuff is old enough to vote (c3e18804), dead since its >> introduction. There is indeed an argument for removing that, it is >> not good to keep around that that has never been stressed and/or >> used. Upon review, the cleanup done looks correct, as we have never >> been able to generate .dat.gz files in for a dump in the tar format. >=20 > Correct. My driving force behind it was to ease up the cleanup/refactoring > work that follows, by eliminating the callers of the GZ*() macros. Makes sense to me. >> + command_fails_like( >> >> + [ 'pg_dump', '--compress', '1', '--format', 'tar' ], >> This addition depending on HAVE_LIBZ is a good thing as a reminder of >> any work that could be done in 0002. Now that's waiting for 20 years >> so I would not hold my breath on this support. I think that this >> could be just applied first, with 0002 on top of it, as a first >> improvement. >=20 > Excellent, thank you. I have applied the test for --compress and --format=3Dtar, separating it =66rom the rest. While moving on with 0002, I have noticed the following in _StartBlob(): if (AH->compression !=3D 0) sfx =3D ".gz"; else sfx =3D ""; =09 Shouldn't this bit also be simplified, adding a fatal() like the other code paths, for safety? >> + compress_cmd =3D> [ >> + $ENV{'GZIP_PROGRAM'}, >> + '-f', >> [...] >> + $ENV{'GZIP_PROGRAM'}, >> + '-k', '-d', >> -f and -d are available everywhere I looked at, but is -k/--keep a >> portable choice with a gzip command? I don't see this option in >> OpenBSD, for one. So this test is going to cause problems on those >> buildfarm machines, at least. Couldn't this part be replaced by a >> simple --test to check that what has been compressed is in correct >> shape? We know that this works, based on our recent experiences with >> the other tests. >=20 > I would argue that the simple '--test' will not do in this case, as the > TAP tests do need a file named .sql to compare the contents with. > This file is generated either directly by pg_dump itself, or by running > pg_restore on pg_dump's output. In the case of compression pg_dump will > generate a .sql. which can not be > used in the comparison tests. So the intention of this block, is not to > simply test for validity, but to also decompress pg_dump's output for it > to be able to be used. Ahh, I see, thanks. I would add a comment about that in the area of compression_gzip_plain_format. + my $supports_compression =3D check_pg_config("#define HAVE_LIBZ 1"); This part could be moved within the if block a couple of lines down. + 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? It seems to me that we should have a description for compress_cmd at the top of 002_pg_dump.pl (close to "Definition of the pg_dump runs to make"). There is an order dependency with restore_cmd. > I updated the patch to simply remove the '-k' flag. Okay. -- Michael --HScUv9d//ae60EaW Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIyBAEBCAAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmJD8JoACgkQnvQgOdby QH3/Qg/4kFg0aogyASLEEqrAMwEgfQzbWBhLD4UiD7OCAyUUW7yIsnZXdt+wJ/ad 0PTLkZfj8YPCEIdadISAgEnBuMa7tpY9evu6Knxv2mcH8YagITRCUGvYQqIxq1Sh PEZjXGvfjvPKGnm82xumn9YrxqoIgTFXqynOxw+eUzlFRFBzpo98EvkXReSx9Kjq G99ch5Q4LjaIRChMCe1waHbBCH2YA5NMPiMi9m4dKrrZJHlD7H/8DG9w7efFaLyU Crc/Gta6wIcfqrVOkYlTJ8J00TzRWbbS/NrR/lYwe6e08rbUwTHGo0eAF9XWb6zi /JugvCPBTenEJvufrp5F2bPMBIFlWzh3PEaAoEvWOEJqo6nx5vOZeasoVec4PUfq PKgtJX6XNdVCsVuoQwzd8OyA6s1pzhTB5/ZmbLCoXZncWjajg23++C6tN56rA08n do2kpmHV++tZUDsOjBcUpeM3qdju4N9pQAM3yGuvArPBjH21tUilc+4c0Gy8j1TA 3iGLIS5GTnqIAY/s7yzS0rT8cSbxSQr+lEVwFmxdLRVUwJcCMrCh1McroqHOwfMz MLRw0FyriW6HYlqQmhOii9BQ8FacM6FIzAvIGcYGp1KFxm3CEYeAbka2VNfeTZ3T 6jEqsGTG1jQGa3vBsreyQ/4/YkYx9VNLwrcF1a4V2Le2lmmyyA== =g424 -----END PGP SIGNATURE----- --HScUv9d//ae60EaW--