pgsql: Unify buffer sizes in pg_dump compression API - Mailing list pgsql-committers

From Tomas Vondra
Subject pgsql: Unify buffer sizes in pg_dump compression API
Date
Msg-id E1pfOGY-0050ri-Aa@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Unify buffer sizes in pg_dump compression API

Prior to the introduction of the compression API in e9960732a9, pg_dump
would use the ZLIB_IN_SIZE/ZLIB_OUT_SIZE to size input/output buffers.
Commit 0da243fed0 introduced similar constants for LZ4, but while gzip
defined both buffers to be 4kB, LZ4 used 4kB and 16kB without any clear
reasoning why that's desirable.

Furthermore, parts of the code unaware of which compression is used
(e.g. pg_backup_directory.c) continued to use ZLIB_OUT_SIZE directly.

Simplify by replacing the various constants with DEFAULT_IO_BUFFER_SIZE,
set to 4kB. The compression implementations still have an option to use
a custom value, but considering 4kB was fine for 20+ years, I find that
unlikely (and we'd probably just increase the default buffer size).

Author: Georgios Kokolatos
Reviewed-by: Tomas Vondra, Justin Pryzby
Discussion: https://postgr.es/m/33496f7c-3449-1426-d568-63f6bca2ac1f@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/f081a48f9a91a245054e94926e2092bd7e85edff

Modified Files
--------------
src/bin/pg_dump/compress_gzip.c       | 22 +++++++++++-----------
src/bin/pg_dump/compress_io.h         |  5 ++---
src/bin/pg_dump/compress_lz4.c        | 11 ++++-------
src/bin/pg_dump/compress_none.c       |  4 ++--
src/bin/pg_dump/pg_backup_directory.c |  4 ++--
5 files changed, 21 insertions(+), 25 deletions(-)


pgsql-committers by date:

Previous
From: Jeff Davis
Date:
Subject: pgsql: Wrap ICU ucol_open().
Next
From: Tom Lane
Date:
Subject: pgsql: Add missing "-I." flag when building pg_bsd_indent.