mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-14 10:13:05 +02:00
Optimized compression to disable headers/crc when the source and destination are both uncompressed.
Set different compression levels based on usage.
This commit is contained in:
parent
0df1b7c473
commit
d874e122aa
@ -1610,13 +1610,13 @@ sub copy
|
||||
if (!$bSourceCompressed && $bDestinationCompress)
|
||||
{
|
||||
($strChecksum, $iFileSize) =
|
||||
$self->{oRemote}->binary_xfer($hSourceFile, $hDestinationFile, 'out', false, undef, false);
|
||||
$self->{oRemote}->binary_xfer($hSourceFile, $hDestinationFile, 'out', false, true, false);
|
||||
}
|
||||
# If the source is compressed and the destination is not then decompress
|
||||
elsif ($bSourceCompressed && !$bDestinationCompress)
|
||||
{
|
||||
($strChecksum, $iFileSize) =
|
||||
$self->{oRemote}->binary_xfer($hSourceFile, $hDestinationFile, 'in', undef, false, false);
|
||||
$self->{oRemote}->binary_xfer($hSourceFile, $hDestinationFile, 'in', true, false, false);
|
||||
}
|
||||
# Else both side are compressed, so copy capturing checksum
|
||||
elsif ($bSourceCompressed)
|
||||
@ -1627,7 +1627,7 @@ sub copy
|
||||
else
|
||||
{
|
||||
($strChecksum, $iFileSize) =
|
||||
$self->{oRemote}->binary_xfer($hSourceFile, $hDestinationFile, 'in', undef, true, false);
|
||||
$self->{oRemote}->binary_xfer($hSourceFile, $hDestinationFile, 'in', false, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -567,7 +567,8 @@ sub binary_xfer
|
||||
|
||||
# Initialize inflate object and check for errors
|
||||
my ($oZLib, $iZLibStatus) =
|
||||
new Compress::Raw::Zlib::Inflate(WindowBits => WANT_GZIP, Bufsize => $self->{iBlockSize}, LimitOutput => 1);
|
||||
new Compress::Raw::Zlib::Inflate(WindowBits => !$bSourceCompressed ? 15 : WANT_GZIP,
|
||||
Bufsize => $self->{iBlockSize}, LimitOutput => 1);
|
||||
|
||||
if ($iZLibStatus != Z_OK)
|
||||
{
|
||||
@ -705,7 +706,9 @@ sub binary_xfer
|
||||
|
||||
# Initialize inflate object and check for errors
|
||||
my ($oZLib, $iZLibStatus) =
|
||||
new Compress::Raw::Zlib::Deflate(WindowBits => WANT_GZIP, Bufsize => $self->{iBlockSize}, AppendOutput => 1);
|
||||
new Compress::Raw::Zlib::Deflate(WindowBits => !$bDestinationCompress ? 15 : WANT_GZIP,
|
||||
Level => !$bSourceCompressed ? Z_BEST_SPEED : Z_DEFAULT_COMPRESSION,
|
||||
Bufsize => $self->{iBlockSize}, AppendOutput => 1);
|
||||
|
||||
if ($iZLibStatus != Z_OK)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user