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 1ndtRq-00021e-VZ for pgsql-hackers@arkaria.postgresql.org; Mon, 11 Apr 2022 12:47:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ndtQr-0006FV-Pf for pgsql-hackers@arkaria.postgresql.org; Mon, 11 Apr 2022 12:46:13 +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 1ndtQr-0006FM-Ec for pgsql-hackers@lists.postgresql.org; Mon, 11 Apr 2022 12:46:13 +0000 Received: from mail-4322.protonmail.ch ([185.70.43.22]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ndtQo-00015n-TJ for pgsql-hackers@lists.postgresql.org; Mon, 11 Apr 2022 12:46:13 +0000 Date: Mon, 11 Apr 2022 12:46:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail2; t=1649681167; bh=J1+x0Wq2s5SCunDsCzS2lA+8yTWUJ7jIJ1B2BzToAv0=; h=Date:To:From:Cc:Reply-To:Subject:Message-ID:In-Reply-To: References:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID; b=qIsd66mQPha4xRuPYGj/lqRVnwHYnfafsUlJzOBGF0R8hyRVlhVkz8bI2VHlBGeai soSKp8zkluFT9+YqrOyjRuYk0CoxFH/MO5hHyPVHqnaoHEdylXFbACP963QNC+Uw8W hjD+89ESMhu1gimh9SO5GRGWaNvnGLAF/9zA6m90cWksrZq0IP8u9cYXBlIsDP9iYt sdVbfJEPGqG1kVQ4R5ZgDjUXQm9A0CTFTM6daOSP76bIcgVfDKkAhUchTt0sLDQgby s3oEvNZntpLoc/meHd2P6zKKL6ZFBpzkvSeKxcS4iv6Fg3Ddftrd+tWbLfy0atrBZw My6A3MBBmwEaA== To: Michael Paquier From: gkokolatos@pm.me Cc: Postgres hackers , Robert Haas Reply-To: gkokolatos@pm.me Subject: Re: Fixes for compression options of pg_receivewal and refactoring of backup_compression.{c,h} Message-ID: In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Monday, April 11th, 2022 at 8:52 AM, Michael Paquier wrote: > This is something I think we had better fix before beta1, because now > we have binaries that use an inconsistent set of options. So, > attached is a patch set aimed at rework this option set from the > ground, taking advantage of the recent work done by Robert and others > for pg_basebackup: Agreed. It is rather inconsistent now. > - 0001 is a simple rename of backup_compression.{c,h} to > compression.{c,h}, removing anything related to base backups from > that. One extra reason behind this renaming is that I would like to > use this infra for pg_dump, but that's material for 16~. I agree with the design. If you permit me a couple of nitpicks regarding na= ming. +typedef enum pg_compress_algorithm +{ + PG_COMPRESSION_NONE, + PG_COMPRESSION_GZIP, + PG_COMPRESSION_LZ4, + PG_COMPRESSION_ZSTD +} pg_compress_algorithm; Elsewhere in the codebase, (e.g. create_table.sgml, alter_table.sgml, brin_tuple.c, detoast.c, toast_compression.c, tupdesc.c, gist.c to mention = a few) variations of of the nomenclature "compression method" are used, like 'VARDATA_COMPRESSED_GET_COMPRESS_METHOD' or 'InvalidCompressionMethod' etc.= I feel that it would be nicer if we followed one naming rule for this and I recommend to substitute algorithm for method throughout. On a similar note, it would help readability to be able to distinguish at a glance the type from the variable. Maybe uppercase or camelcase the type? Last, even though it is not needed now, it will be helpful to have a PG_COMPRESSION_INVALID in some scenarios. Though we can add it when we come= to it. > - 0002 removes WalCompressionMethod, replacing it by > pg_compress_algorithm as these are the same enums. Robert complained > about the confusion that WalCompressionMethod could lead to as this > could be used for the compression of data, and not only WAL. I have > renamed some variables to be more consistent, while on it. It looks good. If you choose to discard the comment regarding the use of 'method' over 'algorithm' from above, can you please use the full word in t= he variable, e.g. 'wal_compress_algorithm' instead of 'wal_compress_algo'. I c= an not really explain it, the later reads a bit rude. Then again that may be j= ust me. > - 0003 is the actual option rework for pg_receivewal. This takes > advantage of 0001, leading to the result of removing --compress-method > and replacing it with --compress, taking care of the backward > compatibility problems for an integer value, aka 0 implies no > compression and val > 0 implies gzip. One bonus reason to switch to > that is that this would make the addition of zstd for pg_receivewal > easier in the future. Looks good. > I am going to add an open item for this stuff. Comments or thoughts? I agree that it is better to not release pg_receivewal with the distinct se= t of options. Cheers, //Georgios > Thanks, > -- > Michael