Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit18ac08f

Browse files
committed
Use min/max bounds defined by Zstd for compression level
The bounds hardcoded in compression.c sinceffd5365 (minimum at 1 andmaximum at 22) do not match the reality of what zstd is able tohandle, these values being available via ZSTD_maxCLevel() andZSTD_minCLevel() at run-time. The maximum of 22 is actually correctin recent versions, but the minimum was not as the library can go downto -131720 by design. This commit changes the code to use the run-timevalues in the code instead of some hardcoded ones.Zstd seems to assume that these bounds could change in the future, andPostgres will be able to adapt automatically to such changes thanks towhat's being done in this commit.Reported-by: Justin PrysbyDiscussion:https://postgr.es/m/20220922033716.GL31833@telsasoft.comBackpatch-through: 15
1 parentcbe6dd1 commit18ac08f

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

‎doc/src/sgml/protocol.sgml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2757,8 +2757,10 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;"
27572757
<literal>-1</literal>), for <literal>lz4</literal> an integer
27582758
between 1 and 12 (default <literal>0</literal> for fast compression
27592759
mode), and for <literal>zstd</literal> an integer between
2760-
<literal>1</literal> and <literal>22</literal> (default
2761-
<literal>ZSTD_CLEVEL_DEFAULT</literal> or <literal>3</literal>).
2760+
<literal>ZSTD_minCLevel()</literal> (usually <literal>-131072</literal>)
2761+
and <literal>ZSTD_maxCLevel()</literal> (usually <literal>22</literal>),
2762+
(default <literal>ZSTD_CLEVEL_DEFAULT</literal> or
2763+
<literal>3</literal>).
27622764
</para>
27632765

27642766
<para>

‎src/common/compression.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,9 @@ validate_compress_specification(pg_compress_specification *spec)
324324
default_level=0;/* fast mode */
325325
break;
326326
casePG_COMPRESSION_ZSTD:
327-
max_level=22;
328327
#ifdefUSE_ZSTD
328+
max_level=ZSTD_maxCLevel();
329+
min_level=ZSTD_minCLevel();
329330
default_level=ZSTD_CLEVEL_DEFAULT;
330331
#endif
331332
break;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp