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 1v8Xnc-002Z4q-G9 for pgsql-hackers@arkaria.postgresql.org; Tue, 14 Oct 2025 05:42:16 +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 1v8Xna-00AY9J-7i for pgsql-hackers@arkaria.postgresql.org; Tue, 14 Oct 2025 05:42:15 +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 1v8XnZ-00AY8x-TB for pgsql-hackers@lists.postgresql.org; Tue, 14 Oct 2025 05:42:14 +0000 Received: from fhigh-a5-smtp.messagingengine.com ([103.168.172.156]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1v8Xmj-0023mr-1T for pgsql-hackers@lists.postgresql.org; Tue, 14 Oct 2025 05:42:14 +0000 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfhigh.phl.internal (Postfix) with ESMTP id EA06614001EA; Tue, 14 Oct 2025 01:41:18 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Tue, 14 Oct 2025 01:41:18 -0400 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=fm2; t=1760420478; x=1760506878; bh=R9mNGD4qu5 ou7kMaK+Zt4ciszGmTk1vba1Ydxga1DY4=; b=gUX4moG7rSMVqt4yFR1MHz4hTL 11bW+wi5LyYi/bkdULEnRqM6cirDztkXveD158ktc2UPe64sTfAaR5gynC7yKXtN BLJnGD1LIqWodA9/qIGq7kZxmXgoO27GEYdf3Ci3DhiLb6sJCM2xnyAxrmdk0xs+ rctV7sKyXTyN3Ccr3Cab85+eR26lOXqCUx1Ag2gvReztpRGfJXFth8NmHFdvXJEf kXNXxZzisYRZktx0pWG3hxPXnLCmqXqs35rMc6so4Hif0XkyJXZcRGTJUQBILZgV 81CEgEFpTGh6IWYGto4rLPyqK+6jBKq/W9PspevSDha5E5tlR8kqxrGW8Vqw== 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=fm2; t= 1760420478; x=1760506878; bh=R9mNGD4qu5ou7kMaK+Zt4ciszGmTk1vba1Y dxga1DY4=; b=dx/2jaq5xz7/IIJWaHGzHorjG6+UpaVcm6iFrd4/QZ7HjVl/7AP gtWzmwJjeEE+04wY8XyLM9mF4Q7DrYzJeNWsj5eyYf5KIY3uf/SJe8XOJ7gILfjT NZcLguQbNvAZFKax900NQYHwlQLEqqf6Goox9A8qwLNW4A4f04P4BgdqpA9x546K qqF0sI2msOscBdcbfwVaGC0y/yfXczSEQ+jfxO7erAP/rRavCfmK/L/a1YE5rtcG AS0z/nW0ZPi0Hyqo3atLVLnU5Og8fJktEhmYyVz1pmZRMZvX3DRzsT1NbrdWVZvE 22x37vaIACqnLS0ZEMGC3k8Hlp9Z6HeVH9Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdduudeljeduucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrh hlucfvnfffucdlfeehmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredttddv necuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqh huihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepieffveeihfehteehudegleevkedt ueeigfehhefgveeileffgedtgedvgfelvddtnecuffhomhgrihhnpehpohhsthhgrhgvsh hqlhdrohhrghdpphhrohhtohhnmhgrihhlrdgtohhmpdhtohgtrdhsohenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprg hquhhivghrrdighiiipdhnsggprhgtphhtthhopeeipdhmohguvgepshhmthhpohhuthdp rhgtphhtthhopehtghhlsehsshhsrdhpghhhrdhprgdruhhspdhrtghpthhtohepghhkoh hkohhlrghtohhssehpmhdrmhgvpdhrtghpthhtohepphhrhiiisgihsehtvghlshgrshho fhhtrdgtohhmpdhrtghpthhtoheprhgrtghhvghlmhhhvggrthhonhesghhmrghilhdrtg homhdprhgtphhtthhopehsthgrrhhksehmihhtrdgvughupdhrtghpthhtohepphhgshhq lhdqhhgrtghkvghrsheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 14 Oct 2025 01:41:16 -0400 (EDT) Date: Tue, 14 Oct 2025 14:40:59 +0900 From: Michael Paquier To: Tom Lane Cc: gkokolatos@pm.me, Justin Pryzby , Rachel Heaton , Greg Stark , pgsql-hackers@lists.postgresql.org Subject: Re: Add LZ4 compression in pg_dump Message-ID: References: <20220326061441.GH28503@telsasoft.com> <25345.1760289877@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="oBmG+nYaUzkwoSlO" Content-Disposition: inline In-Reply-To: <25345.1760289877@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --oBmG+nYaUzkwoSlO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Oct 12, 2025 at 01:24:37PM -0400, Tom Lane wrote: > Michael Paquier writes: >> At the end I am finishing with the attached. I also saw an overlap >> with the addition of --jobs for the directory format vs not using the >> option, so I have removed the case where --jobs was not used in the >> directory format. >=20 > (This patch became commit 98fe74218.) >=20 > I am wondering if you remember why this bit: >=20 > + # Give coverage for manually compressed blob.toc files during > + # restore. > + compress_cmd =3D> { > + program =3D> $ENV{'GZIP_PROGRAM'}, > + args =3D> [ '-f', "$tempdir/compression_gzip_dir/blobs.to= c", ], > + }, > > was set up to manually compress blobs.toc but not the main TOC in the > toc.dat file. It turns out that Gzip_read is broken for the case > of a zero-length read request [1], but we never reach that case > unless toc.dat is compressed. We don't cover the getc_func member > of the compression stream API, either. Using extra commands to emulate the manual compressions of the dump elements is an idea that comes originally from Georgios, and we included in the first version of the patch posted on the original thread:=20 https://www.postgresql.org/message-id/faUNEOpts9vunEaLnmxmG-DldLSg_ql137OC3= JYDmgrOMHm1RvvWY2IdBkv_CRxm5spCCb_OmKNk2T03TMm0fBEWveFF9wA1WizPuAgB7Ss=3D@p= rotonmail.com If I recall correctly, it's something that the two of us have discussed offline because Georgios had sent the patch to the lists. He has argued about these additions in favor of coverage, because he had noticed a bunch of edge cases we never reached with only the tests in core while coding compression support. Regarding toc.dat specifically, I think that we have just failed to consider it as a "valid" case, as far as I can see. So I see no reason to not adding coverage where toc.dat is manuall compressed, and you are giving a good reason to add this part in the test. > I thought for a bit about proposing that we compress toc.dat but not > blobs.toc, but that loses coverage in another way: the gets_func API > turns out to be used only while reading blobs.toc. So we need to > compress both files manually if we want full coverage. > > I think this change won't lose coverage, because there are other tests > in 002_pg_dump.pl that exercise directory format without extra > compression of anything. >=20 > Thoughts? It looks like it should be OK to just add a "manual" compression of toc.dat in compression_gzip_dir. That sounds OK to me here. As far as I can see on HEAD at 1c05fe11abb6, the problem has been fixed in 1f8062dd9668, without a test added for toc.dat. Having coverage would be nice. I would also expand this concept to compression_zstd_dir and compression_lz4_dir, but I guess that you are implying that already to provide coverage for all the compression methods supported by pg_dump?=20 -- Michael --oBmG+nYaUzkwoSlO Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmjt4msACgkQnvQgOdby QH0lzQ//ddpjOLvU2IeOOjwq3WPAex3flOxCJBHplcZw4HRqGy2P1kXM+1Aaiy+A XIiJzoFOA78FYLrTK8BRbMe9RHyJEz8lJUc39KNTxNH6j7pdL6STub/ABCujSU/V 9lKX89Jq6jB6GslJ6AKdaif00Ugi1pNgcqWMqMt1/EdF4Dgt4h5aYhvsBmjCoaFD OtWkDY98LcwaxltxoMHAHOjjfpUqsCge4urMSYEsOCXKgGBsW4p8/3F8zTcqNL2i Tx5pMBib1JUFU1kwULm2OML+/6NJs37otGeMm9jmISyOIYLmEEAq7naHE8yZNkfM owg1f5hxa8CWNwPonYsDTed2uIx9+eOaAL7s8haK10uMpO56Dgh2yyYKG233kftz /kUncq3mYGrvSfuHFhu5qtYriOUVi+Bkua+4wcxPI8He0FzfHZlhJuWABvsAepl9 iWlnyj9cZ8rZyahcuSZOP63hz/WCaeiPd1N9oqBxSKTDjgMtSXNY2wVURvQHYukP Z4Rd1b+T7rhT3lxfRge/IMypRp7UcGnlIeXamI95Ylxb92tttDUwQnvH/nx4fFKU i2KvTE3GKCBKfzsTSNEmnhoYU5B+BFsHja7Lzp6PeRR4hkMw/bRP0PPLhYOKXC+H MZau8L2iorQ5lKlQp2ezftPrE9Gvx2aRxk6aAQfD19B1ibM9TX0= =Bx1T -----END PGP SIGNATURE----- --oBmG+nYaUzkwoSlO--