Re: Refactoring of compression options in pg_basebackup

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Robert Haas <robertmhaas@gmail.com>
Cc: "David G. Johnston" <david.g.johnston@gmail.com>, Alvaro Herrera <alvherre@alvh.no-ip.org>, Magnus Hagander <magnus@hagander.net>, Georgios Kokolatos <gkokolatos@pm.me>, Postgres hackers <pgsql-hackers@lists.postgresql.org>, Jeevan Ladhe <jeevan.ladhe@enterprisedb.com>
Date: 2022-01-26T01:15:27Z
Lists: pgsql-hackers
On Tue, Jan 25, 2022 at 03:14:13PM -0500, Robert Haas wrote:
> On Sat, Jan 22, 2022 at 12:47 AM Michael Paquier <michael@paquier.xyz> wrote:
>> Also, having this enum in walmethods.h is perhaps not the best place
>> either, even more if you plan to use that in pg_basebackup for the
>> server-side compression.  One idea is to rename this enum to
>> DataCompressionMethod, moving it into a new header, like common.h as
>> of the attached.
> 
> Well, we also have CompressionAlgorithm competing for the same job.

Sure, but I don't think that it is a good idea to unify that yet, at
least not until pg_dump is able to handle LZ4 as an option, as the
main benefit that we'd gain here is to be able to change the code to a
switch/case without defaults where we would detect code paths that
require a refresh once adding support for a new option.
--
Michael

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