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 1n5iy8-00025R-6B for pgsql-hackers@arkaria.postgresql.org; Fri, 07 Jan 2022 06:43:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n5iy7-0001nX-00 for pgsql-hackers@arkaria.postgresql.org; Fri, 07 Jan 2022 06:43:19 +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 1n5iy5-0001md-9l for pgsql-hackers@lists.postgresql.org; Fri, 07 Jan 2022 06:43:18 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n5iy2-0002pV-8l for pgsql-hackers@lists.postgresql.org; Fri, 07 Jan 2022 06:43:16 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id BF9E93202F11; Fri, 7 Jan 2022 01:43:10 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Fri, 07 Jan 2022 01:43:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=tjsRedm7hPgdBQaq37qV4pemVzR oDb+6a1HGqnOd8IQ=; b=CoJySh7uFF7UtWazCxDERqVK9F7vSuyLr+pfNjlKDbQ +JBE6kMdTRW5jVS3fgrj/lRatpJYcJfEuU7QhG95dx4FVEkOb4GBR31h1u7FlnBw y1gNBxHRApfoeNQIsMAJfOJ0P5whbnWp0N5sGPUv5S2X/DiJ68R65pny7+3P6rE4 jQDlJXpRu2hmMjdnTG3PZVogTN8ABWAX1qIdeOhYsMXYVozyqG4vluP57zpyaEtD BdmqE9zMAB2bCSnRxy5K65Wdij1ezfB8sKhPVbXTlaTsbFYsEJccl6HtjH3/XRs0 WoomvU+tJnTRqdouVbBh5hNmttvFOT5ZpRjuo3Fnc6g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=tjsRed m7hPgdBQaq37qV4pemVzRoDb+6a1HGqnOd8IQ=; b=eVp5wjKo8znn6DLXyXgcQh e5C7AaaJAS2rmo3FO0ugdW1QpeIyA2WCzffe9JRyNAggwWUECgSbELNORbXxh/x+ EFl3UdFWa4fYj1pdgk6mhG5JIhia3pU91kZpxkQuan3BjdX6QkKjHqI+Q7CNCZS/ TOqap0A58O/ZPKk/UDbA0ifsG6hdnduUJmk+yGlBsELlOY86iX3VBMM1dfIIpWyi 3r2X1shaVH2g1sYhLgA4tQhOkJC9bZL9fgWB2MVJXatct7f9PLt5VVQn8uJZMWur B2Kvzg6ojAmKqv9Nchf6844PrF1JsIB4/7Pt4iUu6POwB9KhDH5OkjNAxP7Oxc9Q == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrudegtddgleegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvuffkfhggtggujgesghdtreertddt vdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg hquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpedvgeduuefhtdeuleettdevjeeh heeiveeuieegleetgeeljeelieeuieehgeevhfenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiii X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 7 Jan 2022 01:43:08 -0500 (EST) Date: Fri, 7 Jan 2022 15:43:06 +0900 From: Michael Paquier To: Robert Haas Cc: Georgios Kokolatos , Postgres hackers , Jeevan Ladhe Subject: Re: Refactoring of compression options in pg_basebackup Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Lt1BQECwolGOXlP4" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Lt1BQECwolGOXlP4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 06, 2022 at 09:27:19AM -0500, Robert Haas wrote: > Did you mean that -z would be a synonym for --compression-method=3Dgzip? > It doesn't really make sense for -Z to be that, unless it's also > setting the compression level. Yes, I meant "-z", not "-Z", to be a synonym of --compression-method=3Dgzip. Sorry for the typo. > My objection to --compress=3D$LEVEL is that the compression level seems > like it ought to rightfully be subordinate to the choice of algorithm. > In general, there's no reason why a compression algorithm has to offer > a choice of compression levels at all, or why they have to be numbered > 0 through 9. For example, lz4 on my system claims to offer compression > levels from 1 through 12, plus a separate set of "fast" compression > levels starting with 1 and going up to an unspecified number. And then > it also has options to favor decompression speed, change the block > size, and a few other parameters. We don't necessarily want to expose > all of those options, but we should structure things so that we could > if it became important. The way to do that is to make the compression > algorithm the primary setting, and then anything else you can set for > that compressor is somehow a subordinate setting. For any compression method, that maps to an integer, so.. But I am not going to fight hard on that. > Put another way, we don't decide first that we want to compress with > level 7, and then afterward decide whether that's gzip, lz4, or bzip2. > We pick the compressor first, and then MAYBE think about changing the > compression level. Which is why things should be checked once all the options are processed. I'd recommend that you read the option patch a bit more, that may help. > Well what I was looking at was this: >=20 > - printf(_(" -Z, --compress=3D0-9 compress tar output with given > compression level\n")); > + printf(_(" -Z, --compress=3D1-9 compress tar output with given > compression level\n")); > + printf(_(" --compression-method=3DMETHOD\n" > + " method to compress data\n")); >=20 > That seems to show that, post-patch, the argument to -Z would be a > compression level, even if --compression-method were something other > than gzip. Yes, after the patch --compress would be a compression level. And, if attempting to use with --compression-method set to "none", or potentially "lz4", it would just fail. If not using this "gzip", the compression level is switched to Z_DEFAULT_COMPRESSION. That's this area of the patch, FWIW: + /* + * Compression-related options. + */ + switch (compression_method) > It's possible that I haven't read something carefully enough, but to > me, what I said seems to be a straightforward conclusion based on > looking at the usage help in the patch. So if I came to the wrong > conclusion, perhaps that usage help isn't reflecting the situation you > intend to create, or not as clearly as it ought. Perhaps the --help output could be clearer, then. Do you have a suggestion? Bringing walmethods.c at the same page for the directory and the tar methods was my primary goal here, and the tests are a bonus, so I've applied this part for now, leaving pg_basebackup alone until we figure out the layer of options we should use. Perhaps it would be better to revisit that stuff once the server-side compression has landed. -- Michael --Lt1BQECwolGOXlP4 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmHX4PoACgkQnvQgOdby QH3xdQ//SZyvTrVdySUv2EAEDwXCyQIR726tPsL8xi/zIkFV1JIkP7PDDpDzcUcL TyIGu5RD6z6I2k17mCMD5fpE3/B9l2CafBiD4i13SF2gpB2L4rcf/k77dY7HenAv EUHTeIyT4D0S0h9Rz3d+Miw4YOGsjYWqTOstWBwGZJtN5LxHDx+64OTZj8iQJlyU U+AYNwX01B65gG3D93U+/NC77IRaC28n8SGI21s6mBYjpVL+EKDQc4EjNiHxwCjC 2tWFHDuE7IUjVom+e/25+IIL4rXl5V+SyRBGD07CpTvPxxDswev7P2UwUtqVCoz7 mColKBTvfKaFwyaTt2ul6I4e/UvaoJJqWCuPMoj7O/fZWXlTZ5SL+0nhgvV787Qt 5Qkj9+eQt6Jog5n0TBuwq0ILLot9Ne8XXjtyjyxnIkkt1QRBTQqRX07riHFdI43A s/uHoPhLmo8rndAjjDSFFyDC5UUlyhuDMKDO6GCEfiLys1AVUPTXYmGHf/JU4jo/ oCiGcrwlnqCW4ntfLYJZ2zhUSZvuf1OeTwCBfXb3vxatjNnEnz9l8hq1efizSwpl C1teFh3Vl84y9elLT2FX21uiLJLJaYc4STu0SzHoihgdxU0IhFNGQjdKPLrxVmfU AuJ0qt+sPumDJDBMRUi9Kba2JsTczdjYGqz/0mMQ9WoaJ40hGe4= =9qCw -----END PGP SIGNATURE----- --Lt1BQECwolGOXlP4--