From a021c9fe053934b9b620f20caffbbf311c457bb8 Mon Sep 17 00:00:00 2001 From: Stephen Frost Date: Tue, 5 May 2020 16:49:01 -0400 Subject: [PATCH] Add bzip2 compression support. bzip2 is a widely available, high-quality data compressor. It typically compresses files to within 10% to 15% of the best available techniques (the PPM family of statistical compressors), while being around twice as fast at compression and six times faster at decompression. bzip2 is currently available on all supported platforms. --- build/lib/pgBackRestBuild/Config/Data.pm | 1 + doc/xml/contributing.xml | 2 +- doc/xml/reference.xml | 1 + doc/xml/release.xml | 10 + doc/xml/user-guide.xml | 4 +- src/Makefile.in | 3 + src/build/configure.ac | 5 + src/common/compress/bz2/common.c | 101 +++++++++ src/common/compress/bz2/common.h | 21 ++ src/common/compress/bz2/compress.c | 196 ++++++++++++++++++ src/common/compress/bz2/compress.h | 22 ++ src/common/compress/bz2/decompress.c | 177 ++++++++++++++++ src/common/compress/bz2/decompress.h | 22 ++ src/common/compress/helper.c | 13 +- src/common/compress/helper.h | 2 +- src/config/define.auto.c | 2 + src/configure | 60 +++++- test/Vagrantfile | 2 +- test/container.yaml | 16 +- test/define.yaml | 5 +- .../pgBackRestTest/Common/ContainerTest.pm | 5 +- test/lib/pgBackRestTest/Common/JobTest.pm | 2 +- .../pgBackRestTest/Env/Host/HostBackupTest.pm | 2 + .../pgBackRestTest/Module/Mock/MockAllTest.pm | 6 +- .../Module/Mock/MockArchiveStopTest.pm | 2 +- .../Module/Mock/MockArchiveTest.pm | 10 +- .../Module/Mock/MockStanzaTest.pm | 6 +- .../pgBackRestTest/Module/Real/RealAllTest.pm | 2 +- test/patch/debian-package.patch | 3 +- test/src/module/common/compressTest.c | 55 ++++- test/travis.pl | 2 +- 31 files changed, 720 insertions(+), 40 deletions(-) create mode 100644 src/common/compress/bz2/common.c create mode 100644 src/common/compress/bz2/common.h create mode 100644 src/common/compress/bz2/compress.c create mode 100644 src/common/compress/bz2/compress.h create mode 100644 src/common/compress/bz2/decompress.c create mode 100644 src/common/compress/bz2/decompress.h diff --git a/build/lib/pgBackRestBuild/Config/Data.pm b/build/lib/pgBackRestBuild/Config/Data.pm index e22745cc5..8f40b6dc7 100644 --- a/build/lib/pgBackRestBuild/Config/Data.pm +++ b/build/lib/pgBackRestBuild/Config/Data.pm @@ -1234,6 +1234,7 @@ my %hConfigDefine = &CFGDEF_ALLOW_LIST => [ 'none', + 'bz2', 'gz', 'lz4', 'zst', diff --git a/doc/xml/contributing.xml b/doc/xml/contributing.xml index 626ec8d21..1723f01be 100644 --- a/doc/xml/contributing.xml +++ b/doc/xml/contributing.xml @@ -64,7 +64,7 @@ apt-get install rsync git devscripts build-essential valgrind lcov autoconf autoconf-archive libssl-dev zlib1g-dev libxml2-dev libpq-dev pkg-config libxml-checker-perl libyaml-libyaml-perl libdbd-pg-perl liblz4-dev liblz4-tool - zstd libzstd-dev + zstd libzstd-dev bzip2 libbz2-dev -y 2>&1 diff --git a/doc/xml/reference.xml b/doc/xml/reference.xml index 35763d7fb..cc329c0f6 100644 --- a/doc/xml/reference.xml +++ b/doc/xml/reference.xml @@ -141,6 +141,7 @@ The following compression types are supported: