pgsql: Refactor tar method of walmethods.c to rely on the compression m
Refactor tar method of walmethods.c to rely on the compression method
Since d62bcc8, the directory method of walmethods.c uses the compression
method to determine which code path to take. The tar method, used by
pg_basebackup --format=t, was inconsistent regarding that, as it relied
on the compression level to check if no compression or gzip should be
used. This commit makes the code more consistent as a whole in this
file, making the tar logic use a compression method rather than
assigning COMPRESSION_NONE that would be ignored.
The options of pg_basebackup are planned to be reworked but we are not
sure yet of the shape they should have as this has some dependency with
the integration of the server-side compression for base backups, so this
is left out for the moment. This change has as benefit to make easier
the future integration of new compression methods for the tar method of
walmethods.c, for the client-side compression.
Reviewed-by: Georgios Kokolatos
Discussion: /messages/by-id/Yb3GEgWwcu4wZDuA@paquier.xyz
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/000f3adfdc4336df83777eba86ce48f36cb6c6e9
Modified Files
--------------
src/bin/pg_basebackup/pg_basebackup.c | 3 +-
src/bin/pg_basebackup/walmethods.c | 57 ++++++++++++++++++++++-------------
2 files changed, 38 insertions(+), 22 deletions(-)
Re: Michael Paquier
Refactor tar method of walmethods.c to rely on the compression method
Hi,
since about this commit, pg_wal.tar is no longer compressed at all:
$ pg_basebackup -D foo --format=tar
$ ls -l foo/
-rw------- 1 cbe cbe 137152 7. Jan 15:37 backup_manifest
-rw------- 1 cbe cbe 23606272 7. Jan 15:37 base.tar
-rw------- 1 cbe cbe 16778752 7. Jan 15:37 pg_wal.tar
$ pg_basebackup -D foogz --format=tar --gzip
$ ls -l foogz
-rw------- 1 cbe cbe 137152 7. Jan 15:37 backup_manifest
-rw------- 1 cbe cbe 3073257 7. Jan 15:37 base.tar.gz
-rw------- 1 cbe cbe 16779264 7. Jan 15:37 pg_wal.tar <-- should be pg_wal.tar.gz
Christoph
On Fri, Jan 07, 2022 at 03:41:16PM +0100, Christoph Berg wrote:
since about this commit, pg_wal.tar is no longer compressed at all:
Thanks. That's a thinko coming from the fact that
Z_DEFAULT_COMPRESSION is -1, combination possible when specifying only
--gzip. So, fixed.
--
Michael