barman icon indicating copy to clipboard operation
barman copied to clipboard

custom_decompression_filter with barman-wal-restore

Open sahapasci opened this issue 5 years ago • 1 comments

Hi folks,

The wal compression works well and fast with the configuration below;

[barman]
...
compression = custom
custom_compression_filter   = /usr/bin/pigz --stdout --processes 8 --best
custom_decompression_filter = /usr/bin/pigz --stdout --processes 8 --decompress

The configuration is written in both in barman.conf and in barman.d/cluster_name.conf

However, when I use barman-wal-restore (I think) it doesn't use custom_decompression_filter that I have. Instead its using gzip.

Here is my postgresql.conf related.

restore_command = 'barman-wal-restore --user barman barman_host cluster_name %f %p'

And the output of barman (anonymized) ;

2020-12-20 14:55:43,327 [114581] barman.config DEBUG: Including configuration file: cluster_name.conf
2020-12-20 14:55:43,328 [114581] barman.cli DEBUG: Initialised Barman version 2.12 (config: /etc/barman.conf, args: {'color': 'auto', 'quiet': False, 'debug': False, 'format': 'console', 'server_name': 'cluster_name', 'wal_name': '000000260000690B00000074', 'partial': False, 'command': 'get_wal'})
2020-12-20 14:55:43,333 [114581] barman.server DEBUG: Retention policy for server cluster_name: REDUNDANCY 2
2020-12-20 14:55:43,334 [114581] barman.server DEBUG: WAL retention policy for server cluster_name: MAIN
2020-12-20 14:55:43,336 [114581] barman.server INFO: Sending WAL '000000260000690B00000074' for server 'cluster_name' to standard output (SSH host: 192.168.1.10)
2020-12-20 14:55:43,347 [114581] barman.command_wrappers DEBUG: Command: 'barman_command(){ gzip -c -d > "$2" < "$1";}; barman_command \'/pg_backup/12/main/cluster_name/wals/000000260000690B/000000260000690B00000074\' \'/pg_backup/12/main/cluster_name/wals/.000000260000690B00000074.2cis7_gw.uncompressed\''

Environment

server machine; barman 2.12
client machine;  barman-wal-restore 2.12
PostgreSQL version 12.5 
Debian GNU/Linux 10 (buster)

sahapasci avatar Dec 20 '20 12:12 sahapasci

I think you actually have not assigned the custom_compression_magic which is needed to actually invoke the custom commands.

Since pigz is just a parellel implementation it might always match the gzip for decompression.

i.e. not a bug

Just set your compression=pigz

see here: https://docs.pgbarman.org/release/3.4.0/#wal-compression

thoro avatar Feb 10 '23 10:02 thoro