# Copyright (c) 2021-2025, PostgreSQL Global Development Group
# This test aims to verify that the client can decompress and extract # a backup which was compressed by the server.
use strict;
use warnings FATAL => 'all';
use File::Path qw(rmtree);
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;
use Test::More;
my $primary = PostgreSQL::Test::Cluster->new('primary');
$primary->init(allows_streaming => 1);
$primary->start;
for my $tc (@test_configuration)
{
my $backup_path = $primary->backup_dir . '/' . 'extract_backup';
my $method = $tc->{'compression_method'};
SKIP:
{
skip "$method compression not supported by this build", 2 if !$tc->{'enabled'};
# A backup with a valid compression method should work.
my $backup_stdout = '';
my $backup_stderr = '';
my $backup_result = $primary->run_log(
[ 'pg_basebackup', '--pgdata' => $backup_path, '--wal-method' => 'fetch', '--no-sync', '--checkpoint' => 'fast', '--format' => 'plain',
@{ $tc->{'backup_flags'} },
], '>' => \$backup_stdout, '2>' => \$backup_stderr); if ($backup_stdout ne '')
{
print "# standard output was:\n$backup_stdout";
} if ($backup_stderr ne '')
{
print "# standard error was:\n$backup_stderr";
} if ( !$backup_result
&& $tc->{'possibly_unsupported'}
&& $backup_stderr =~ /$tc->{'possibly_unsupported'}/)
{
skip "compression with $method not supported by this build", 2;
} else
{
ok($backup_result, "backup done, compression $method");
}
# Make sure that it verifies OK.
$primary->command_ok(
[ 'pg_verifybackup', '--exit-on-error', $backup_path ], "backup verified, compression method \"$method\"");
}
# Remove backup immediately to save disk space.
rmtree($backup_path);
}
done_testing();
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet am 2026-08-08)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.