pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Unify buffer sizes in pg_dump compression API
Date: Thu, 23 Mar 2023 16:58:18 +0000
Message-ID: <E1pfOGY-0050ri-Aa@gemulon.postgresql.org> (raw)

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(-)



Message-ID: <E1pfOGY-0050ri-Aa@gemulon.postgresql.org>
Permalink:  ../E1pfOGY-0050ri-Aa@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1pfOGY-0050ri-Aa@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tomas.vondra@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Unify buffer sizes in pg_dump compression API
  In-Reply-To: <E1pfOGY-0050ri-Aa@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox