pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Use min/max bounds defined by Zstd for compression level
Date: Thu, 22 Sep 2022 11:04:05 +0000
Message-ID: <E1obJzx-001Uck-9I@gemulon.postgresql.org> (raw)

Use min/max bounds defined by Zstd for compression level

The bounds hardcoded in compression.c since ffd5365 (minimum at 1 and
maximum at 22) do not match the reality of what zstd is able to
handle, these values being available via ZSTD_maxCLevel() and
ZSTD_minCLevel() at run-time.  The maximum of 22 is actually correct
in recent versions, but the minimum was not as the library can go down
to -131720 by design.  This commit changes the code to use the run-time
values in the code instead of some hardcoded ones.

Zstd seems to assume that these bounds could change in the future, and
Postgres will be able to adapt automatically to such changes thanks to
what's being done in this commit.

Reported-by: Justin Prysby
Discussion: https://postgr.es/m/20220922033716.GL31833@telsasoft.com
Backpatch-through: 15

Branch
------
REL_15_STABLE

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

Modified Files
--------------
doc/src/sgml/protocol.sgml | 6 ++++--
src/common/compression.c   | 3 ++-
2 files changed, 6 insertions(+), 3 deletions(-)



view thread (2+ messages)  latest in thread

Message-ID: <E1obJzx-001Uck-9I@gemulon.postgresql.org>
Permalink:  ../E1obJzx-001Uck-9I@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1obJzx-001Uck-9I@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz
  Subject: Re: pgsql: Use min/max bounds defined by Zstd for compression level
  In-Reply-To: <E1obJzx-001Uck-9I@gemulon.postgresql.org>
  References: <E1obJzx-001Uck-9I@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