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 1p25Xn-0006OR-RE for pgsql-hackers@arkaria.postgresql.org; Mon, 05 Dec 2022 07:05:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p25Xm-0000G6-Q1 for pgsql-hackers@arkaria.postgresql.org; Mon, 05 Dec 2022 07:05:38 +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 1p25Xk-0000Fe-Vj for pgsql-hackers@lists.postgresql.org; Mon, 05 Dec 2022 07:05:38 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p25Xg-0008Id-EP for pgsql-hackers@lists.postgresql.org; Mon, 05 Dec 2022 07:05:36 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 6D5B45C005F; Mon, 5 Dec 2022 02:05:29 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Mon, 05 Dec 2022 02:05:29 -0500 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; t=1670223929; x=1670310329; bh=KQduDJ+2yR G8t678PCHKpomYvJoti1uKD1WSdbSmSuA=; b=EzllZ/XqgBKlPsZZWgRvUzMap+ qLRu+YHxihECFFGTu5V7fSgS0MUDm+WbZo4mW+Rz1mStdkxv0iida1/l9hYuwbLz 744ri18DB1vqCyGVtirJdF/FvKjz/aoXp8uBOBSpEXTkBkeIprcn0Hk3H94Oqds8 5WHRdnfCl9OsUk0RayML6uq8gNn56/ZJK8zjgJss28YovCxjfSz2umJdPtgUoNSY I7ULy5ZsqNtqs9YAqClWV+laqLqq1iJRrU3fGNCOZiyOvr3wbVptmwuVdrju3QsF zhrqwO3LEFgPQ+tFpntRHoo4PLKA9kkxIjmWqx9RX7cDUUGOeI2LqI7DTCTA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id: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= fm1; t=1670223929; x=1670310329; bh=KQduDJ+2yRG8t678PCHKpomYvJot i1uKD1WSdbSmSuA=; b=sFF/eQPHgpUQfxC4MmervNK4CPkD0zfftYWfg/15OlBy 89edOoRfytniNi999r+0KZ1NTRajcgo3VuTMen0DQb3e3DeqMzn+Lu/r2UidRdhz Q+xoWq0JhW+xo6FCCwaGzmiQTPOU0ZIT9OFUa8Wv02YkccA1WNsGNVedJi58+e3f DBaZ8uOBLJZy0VwFc3LuDwJZuc9pWmc6Q1g4VvrCEDtqPLUlL1+nYQGV6L+HjWB+ N0YmGloKHCz8MKEDVEyOTqAyWg2Zw1jCTC4/DCg6+iKLRQWUJqysX1kIwyldxuXb D6z/YvSqPhvIYqwj+9f3qagltKDgvxjrP/3xiN1xsA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudefgddutdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredt tddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeg geegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiih ii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 5 Dec 2022 02:05:27 -0500 (EST) Date: Mon, 5 Dec 2022 16:05:23 +0900 From: Michael Paquier To: gkokolatos@pm.me Cc: Justin Pryzby , pgsql-hackers@lists.postgresql.org, Rachel Heaton Subject: Re: Add LZ4 compression in pg_dump Message-ID: References: <1j_ONBQqU3lQW7OqwbAFKbgcqjQosikcp7VPINqegLrHMCMGtFcXAuyjmW__VeviKyCbKTtucxFyPFUJ7sfqeOf4O90JEuUIe99Z5v7sdOg=@pm.me> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="o9C5rQcnPLNgXvO4" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --o9C5rQcnPLNgXvO4 Content-Type: multipart/mixed; boundary="itEnfeIqgZwIC90d" Content-Disposition: inline --itEnfeIqgZwIC90d Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, Dec 03, 2022 at 11:45:30AM +0900, Michael Paquier wrote: > While this is correct in checking that the contents are compressed > under --with-zlib, this also removes the coverage where we make sure > that this command is able to complete under --without-zlib without > compressing any of the table data files. Hence my point from > upthread: this test had better not use compile_option, but change > glob_pattern depending on if the build uses zlib or not. In short, I mean something like the attached. I have named the flag content_patterns, and switched it to an array so as we can check that toc.dat is always uncompression and that the other data files are always uncompressed. > In order to check this behavior with defaults_custom_format, perhaps > we could just remove the -Z6 from it or add an extra command for its > default behavior? This is slightly more complicated as there is just one file generated for the compression and non-compression cases, so I have let that as it is now. -- Michael --itEnfeIqgZwIC90d Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v15-0001-Provide-coverage-for-pg_dump-default-compression.patch" Content-Transfer-Encoding: quoted-printable =46rom 5c583358caed5598fec9abea6750ff7fbd98d269 Mon Sep 17 00:00:00 2001 =46rom: Michael Paquier Date: Mon, 5 Dec 2022 16:04:57 +0900 Subject: [PATCH v15] Provide coverage for pg_dump default compression for d= ir format The restore program will succeed regardless of whether the dumped output was compressed or not. This commit implements a portable way to check the conte= nts of the directory via perl's build in filename expansion. --- src/bin/pg_dump/t/002_pg_dump.pl | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_du= mp.pl index 709db0986d..9796d2667f 100644 --- a/src/bin/pg_dump/t/002_pg_dump.pl +++ b/src/bin/pg_dump/t/002_pg_dump.pl @@ -36,6 +36,9 @@ my $tempdir =3D PostgreSQL::Test::Utils::tempdir; # to test pg_restore's ability to parse manually compressed files # that otherwise pg_dump does not compress on its own (e.g. *.toc). # +# content_patterns is an optional array consisting of strings compilable +# with glob() to check the files generated after a dump. +# # restore_cmd is the pg_restore command to run, if any. Note # that this should generally be used when the pg_dump goes to # a non-text file and that the restore can then be used to @@ -46,6 +49,10 @@ my $tempdir =3D PostgreSQL::Test::Utils::tempdir; # database and then pg_dump *that* database (or something along # those lines) to validate that part of the process. =20 +my $supports_icu =3D ($ENV{with_icu} eq 'yes'); +my $supports_lz4 =3D check_pg_config("#define USE_LZ4 1"); +my $supports_gzip =3D check_pg_config("#define HAVE_LIBZ 1"); + my %pgdump_runs =3D ( binary_upgrade =3D> { dump_cmd =3D> [ @@ -213,6 +220,9 @@ my %pgdump_runs =3D ( }, =20 # Do not use --no-sync to give test coverage for data sync. + # By default, the directory format compresses its contents + # when the code is compiled with gzip support, and lets things + # uncompressed when not compiled with it. defaults_dir_format =3D> { test_key =3D> 'defaults', dump_cmd =3D> [ @@ -224,6 +234,11 @@ my %pgdump_runs =3D ( "--file=3D$tempdir/defaults_dir_format.sql", "$tempdir/defaults_dir_format", ], + content_patterns =3D> ["$tempdir/defaults_dir_format/toc.dat", + $supports_gzip ? + "$tempdir/defaults_dir_format/*.dat.gz" : + "$tempdir/defaults_dir_format/*.dat", + ], }, =20 # Do not use --no-sync to give test coverage for data sync. @@ -3920,10 +3935,6 @@ if ($collation_check_stderr !~ /ERROR: /) $collation_support =3D 1; } =20 -my $supports_icu =3D ($ENV{with_icu} eq 'yes'); -my $supports_lz4 =3D check_pg_config("#define USE_LZ4 1"); -my $supports_gzip =3D check_pg_config("#define HAVE_LIBZ 1"); - # ICU doesn't work with some encodings my $encoding =3D $node->safe_psql('postgres', 'show server_encoding'); $supports_icu =3D 0 if $encoding eq 'SQL_ASCII'; @@ -4153,6 +4164,16 @@ foreach my $run (sort keys %pgdump_runs) command_ok(\@full_compress_cmd, "$run: compression commands"); } =20 + if ($pgdump_runs{$run}->{content_patterns}) + { + my $content_patterns =3D $pgdump_runs{$run}->{content_patterns}; + foreach my $content_pattern (@{$content_patterns}) + { + my @glob_output =3D glob($content_pattern); + is(scalar(@glob_output) > 0, 1, "$run: content check for $content_patte= rn"); + } + } + if ($pgdump_runs{$run}->{restore_cmd}) { $node->command_ok(\@{ $pgdump_runs{$run}->{restore_cmd} }, --=20 2.38.1 --itEnfeIqgZwIC90d-- --o9C5rQcnPLNgXvO4 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmONmDMACgkQnvQgOdby QH0U3RAAmWgUIR8ILfYg9Ul19T2CVRqRjWFbOr7BEsSH70hlIoTz0jJ8fb2VC15Q W3MJavgh2rd9o4OuO3eZ/SW0moqr0KjV/9Roj5sTxJpfCdVNn8DDM60gJvmJOndZ cSeCeGvQ8TZjZwrkLflUFbparEvHZ+0PnxpQ0GXGlsTXdOgT8vHNLlTW6+8Krpiu I7c5kyI07vJhMtc5hqHxyvj+eGAeiM073n3bXjvVosjl1z3XrOflggUUcTTu9pGJ 5Vza/T6B3aCPuNtBWm6NxMytWkq4iuEDJf8drQYK/IhvF3QDDxpunJBPqmKOn8z0 1k41Udkh6GflWEw1+jltNLnfaJAt0v5S+1WA77amLTPA7mVPn2LmRp31sKPCRgG9 kxU4zB9uxJN5U4IBO4cfAvcmDh7KTq5epLXIUkbF0+MHcsF9N8J7jDL0rpyMdnNh 1O+f24e93G6xMiql0p5Rxq6pkF9osEMZeeKrZGTCCKrfzVwwL6rf7rugr6SjRIUj +/LQFaS5IcyM0gUZ/JyowQ91xPhKtfcM24LLH/CjVIGcUJ1jAbLo/kgjGZaufowf BhNuRLHqSIWtiMQ1LifgdDPaNLmILAqlRoz0cPDGazxUhLW3I+NyRa+Mzu4fu0iU 9AxBQyFu8T64Ze7M9yUgozkG0B9H7uQYdFTcr6a+W3b6ADL4nL0= =frAf -----END PGP SIGNATURE----- --o9C5rQcnPLNgXvO4--