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 1pHEJ8-0004xj-Ib for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Jan 2023 01:29:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pHEJ7-0002vJ-CF for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Jan 2023 01:29:05 +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 1pHEJ6-0002vA-E9 for pgsql-hackers@lists.postgresql.org; Mon, 16 Jan 2023 01:29:05 +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 1pHEJ3-0001Rz-NN for pgsql-hackers@lists.postgresql.org; Mon, 16 Jan 2023 01:29:04 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id E02FA5C00E0; Sun, 15 Jan 2023 20:28:59 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Sun, 15 Jan 2023 20:28:59 -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=fm3; t=1673832539; x=1673918939; bh=blkZ1w7f3t wcb6UCt7iz0VeuyfdfFvcW3nXYnhqU1Yw=; b=ud4fWtcApfRqtQuYJn0oaioUR6 HFN41Dbf97Pfy0Vx6sQBE6s1N/ef1Ly2791AZrLIwYz1DFkmhGirSmJM6rxxKB5F BEiPk3xA38v70i/dOscOobNrjKJeWNaa5Jq8lGWQr6JyhQq6o967lI3k1w260o3v FV7u9eGftrR6+JmumqflJJs1TX5xrTe4DlnjztloANTdKsKnwNCS0jv+55SfcKpj N8qlfPa9f0RBIqaeTxaBAkJdXiMSQoIugou79e4MjblqW6DcuH/g0a+ppUoQBWqK ZIo/eHhIQ2JZznt2qlMUDUETjJGFXskW54SwRuehoaouNFVTme67mcxjFeig== 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= fm3; t=1673832539; x=1673918939; bh=blkZ1w7f3twcb6UCt7iz0Veuyfdf FvcW3nXYnhqU1Yw=; b=n61g8qwHmSo/vT8rVKb8x+WUdzBOi3ok0Nr75BsLmuRZ YAuwCyU2gUoYPCcNd6OyU4mhiwFT2lnDM+hsIlIqz3WcbJl+BSQcm1YnYEl3WCS3 J4gfolVPBm+3LHwqOA7TWmBjgaDi5geN+mKxy8aosIrORFC9c56h/KzyfLqcVxXy /hRTEmZTAmde0wgAxICS8GpUSMIV3swy7CPfXOql1gSWq63ECLVPz77gpqtpaQxB dPcp+r2oc1W5gZVuXgOZuEo8OgF2tYNYzjhx9uvLK30ROd+Z3336njWvlNK/jjFh xnoKF3BmyXu8oAD+dHxuxAr+bNWOYCQkFJJlZJkcBQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedruddtfedgfeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredt tddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeg geegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiih ii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 15 Jan 2023 20:28:57 -0500 (EST) Date: Mon, 16 Jan 2023 10:28:50 +0900 From: Michael Paquier To: Justin Pryzby Cc: gkokolatos@pm.me, pgsql-hackers@lists.postgresql.org, Rachel Heaton Subject: Re: Add LZ4 compression in pg_dump Message-ID: References: <20221217232615.GS1153@telsasoft.com> <20221219172706.GA1153@telsasoft.com> <20221220152610.GG1153@telsasoft.com> <20221222170859.GO1153@telsasoft.com> <20230108194524.GA27637@telsasoft.com> <20230114214308.GC9837@telsasoft.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Gc5SdB1sLC36Oh1j" Content-Disposition: inline In-Reply-To: <20230114214308.GC9837@telsasoft.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Gc5SdB1sLC36Oh1j Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jan 14, 2023 at 03:43:09PM -0600, Justin Pryzby wrote: > On Sun, Jan 08, 2023 at 01:45:25PM -0600, Justin Pryzby wrote: >> pg_compress_specification is being passed by value, but I think it >> should be passed as a pointer, as is done everywhere else. >=20 > ISTM that was an issue with 5e73a6048, affecting a few public and > private functions. I wrote a pre-preparatory patch which changes to > pass by reference. The functions changed by 0001 are cfopen[_write](), AllocateCompressor() and ReadDataFromArchive(). Why is it a good idea to change these interfaces which basically exist to handle inputs? Is there some benefit in changing compression_spec within the internals of these routines before going back one layer down to their callers? Changing the compression_spec on-the-fly in these internal paths could be risky, actually, no? > And addressed a handful of other issues I reported as separate fixup > commits. And changed to use LZ4 by default for CI. Are your slight changes shaped as of 0003-f.patch, 0005-f.patch and 0007-f.patch on top of the original patches sent by Georgios? > I also rebased my 2 year old patch to support zstd in pg_dump. I hope > it can finally added for v16. I'll send it for the next CF if these > patches progress. Good idea to see if what you have done for zstd fits with what's presented here. >> pg_compress_algorithm is being writen directly into the pg_dump header. Do you mean that this is what happens once the patch series 0001~0008 sent upthread is applied on HEAD? >> Currently, I think that's not an externally-visible value (it could be >> renumbered, theoretically even in a minor release). Maybe there should >> be a "private" enum for encoding the pg_dump header, similar to >> WAL_COMPRESSION_LZ4 vs BKPIMAGE_COMPRESS_LZ4 ? Or else a comment there >> should warn that the values are encoded in pg_dump, and must never be >> changed. >=20 > Michael, WDYT ? Changing the order of the members in an enum would cause an ABI breakage, so that would not happen, and we tend to be very careful about that. Appending new members would be fine, though. FWIW, I'd rather avoid adding more enums that would just be exact maps to pg_compress_algorithm. - /* - * For now the compression type is implied by the level. This will need - * to change once support for more compression algorithms is added, - * requiring a format bump. - */ - WriteInt(AH, AH->compression_spec.level); + AH->WriteBytePtr(AH, AH->compression_spec.algorithm); I may be missing something here, but it seems to me that you ought to store as well the level in the dump header, or it would not be possible to report in the dump's description what was used? Hence, K_VERS_1_15 should imply that we have both the method compression and the compression level. -- Michael --Gc5SdB1sLC36Oh1j Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmPEqFIACgkQnvQgOdby QH0PVA/+KCrhjH+LAtpAp3b8kOmPG4my/UI9B0H5NRIq4jPMQdfz1Id45JvOhkCF vuRFlQZJ33aihkGnQLZZR9PNltabLDtGMugP57buZ+CjsB1BtySd1T2DHyjdecGm 0Up6eOrgULPfbtNbwCQ4RLG4B29BrKlrhQkOK/hN3yrWfu1vfZp6i2NWEVFdfeLH RDzIpSaNiVul50MgWCWP96vWdn9g+4CcZheXKyTXFkc1Tp/jD4oSWE+hIuLBVq+7 Suv6URni718GMqcHYkTETI9IUlOZl5N8dh6TOUQxQpPFurafaiIoQhyxf25azrhJ e0kkmBVH/LXMJozEPnKgbAFQltqXJPf2quqtARdtlT5g4u0/iQLmfaFs9Mpev3YV 1wvUboZ0IGXutFFkmMVQbue6NFC8Oz2q1htbTuXU0qDwslG8PcD09ME0j13lK7hn WW4lqQsmESe1dVxRL0OmHG20hNN5Ia+8wzEgt1cI4GiLjA5vmTulbum8JETjKRzq 5BZVMDcDNNw8p0VoLEI4L6YiV+2Bz75cipB8faGrFtb8bS6Gcr93ZD+KWCuzntEG DFqQSYQDulzMH9vXL/DrRb3NMmmartxLFkUEwpy3GgLiMBqeJsZ04N0jTftDDbL0 E2tyjQ9WfW7phtd+g6xUnpEcXVH96NIY+PnsVf2+t7UFyvIMnkw= =AA5J -----END PGP SIGNATURE----- --Gc5SdB1sLC36Oh1j--