Re: Refactoring of compression options in pg_basebackup

Robert Haas <robertmhaas@gmail.com>

From: Robert Haas <robertmhaas@gmail.com>
To: "David G. Johnston" <david.g.johnston@gmail.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>, Magnus Hagander <magnus@hagander.net>, Michael Paquier <michael@paquier.xyz>, Georgios Kokolatos <gkokolatos@pm.me>, Postgres hackers <pgsql-hackers@lists.postgresql.org>, Jeevan Ladhe <jeevan.ladhe@enterprisedb.com>
Date: 2022-01-17T17:48:12Z
Lists: pgsql-hackers
On Mon, Jan 17, 2022 at 11:50 AM David G. Johnston
<david.g.johnston@gmail.com> wrote:
>> I think having a single option where you specify everything is simpler.
>> I propose we accept these forms:
>>
>> --compress=[{server,client}-]method[:level]     new in 15
>> --compress=level                (accepted by 14)
>> -Z level                        (accepted by 14)
>> -z                              (accepted by 14)
>
> I am also in favor of this option.  Whether this is better than deprecating --compress and introducing --compression I am having trouble deciding.  My personal preference is to add --compression and leave --compress alone and deprecated; but we don't usually do anything with deprecations and having users seeing both --compress and --compression out in the wild, even if never at the same time, is bound to elicit questions (though so is seeing --compress with "number only" rules and "composite value" rules...)

Alvaro's proposal is fine with me. I don't see any value in replacing
--compress with --compression. It's longer but not superior in any way
that I can see. Having both seems worst of all -- that's just
confusing.

> I'm not too keen on making a default method in code.  Saying "if in doubt gzip is a widely used compression method." in the documentation seems sufficient.

Yeah, I agree that a default method doesn't seem necessary. People who
want to compress without thinking hard can use -z; others can say what
they want.

-- 
Robert Haas
EDB: http://www.enterprisedb.com



Commits

  1. Extend the options of pg_basebackup to control compression

  2. Add TAP tests for pg_basebackup with compression

  3. Refactor tar method of walmethods.c to rely on the compression method