You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Romain Hardouin (Jira)" <ji...@apache.org> on 2019/09/02 17:04:00 UTC

[jira] [Comment Edited] (CASSANDRA-15296) ZstdCompressor compression_level setting

    [ https://issues.apache.org/jira/browse/CASSANDRA-15296?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16920975#comment-16920975 ] 

Romain Hardouin edited comment on CASSANDRA-15296 at 9/2/19 5:03 PM:
---------------------------------------------------------------------

 TLDR: the compression level interval is {{[-(2<<17), 22]}} i.e. {{[-131072, 22]}}

Looking at Z Standard C sources, the maximum is 22, not 2 (it's a typo):
{code:c}
#define ZSTD_MAX_CLEVEL     22
int ZSTD_maxCLevel(void) { return ZSTD_MAX_CLEVEL; }
int ZSTD_minCLevel(void) { return (int)-ZSTD_TARGETLENGTH_MAX; }
{code}
[https://github.com/facebook/zstd/blob/519834738228cc810b48a2d44ff295b845842af4/lib/compress/zstd_compress.c#L3823]

 
 {{ZSTD_TARGETLENGTH_MAX}} is defined as:
{code:c}
#define ZSTD_TARGETLENGTH_MAX    ZSTD_BLOCKSIZE_MAX
{code}
{code:c}
#define ZSTD_BLOCKSIZELOG_MAX  17
#define ZSTD_BLOCKSIZE_MAX     (1<<ZSTD_BLOCKSIZELOG_MAX)
{code}


was (Author: rha):
 TLDR: the compression level interval is {{[-(2<<17), 22]}} i.e. {{[-131072, 22]}}

Looking at Z Standard C sources, the maximum is indeed 22, not 2 (it's a typo):
{code:c}
#define ZSTD_MAX_CLEVEL     22
int ZSTD_maxCLevel(void) { return ZSTD_MAX_CLEVEL; }
int ZSTD_minCLevel(void) { return (int)-ZSTD_TARGETLENGTH_MAX; }
{code}
[https://github.com/facebook/zstd/blob/519834738228cc810b48a2d44ff295b845842af4/lib/compress/zstd_compress.c#L3823]

 
 {{ZSTD_TARGETLENGTH_MAX}} is defined as:
{code:c}
#define ZSTD_TARGETLENGTH_MAX    ZSTD_BLOCKSIZE_MAX
{code}
{code:c}
#define ZSTD_BLOCKSIZELOG_MAX  17
#define ZSTD_BLOCKSIZE_MAX     (1<<ZSTD_BLOCKSIZELOG_MAX)
{code}

> ZstdCompressor compression_level setting
> ----------------------------------------
>
>                 Key: CASSANDRA-15296
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-15296
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Dependencies, Feature/Compression
>            Reporter: DeepakVohra
>            Priority: Normal
>
> The DEFAULT_COMPRESSION_LEVEL for ZstdCompressor is set to 3, but its range for compression_level is indicated to be between -131072 and 2.  The default value is outside the range. Is it by design or a bug?
> {code:java}
> - ``compression_level`` is only applicable for ``ZstdCompressor`` and accepts values between ``-131072`` and ``2``.
> // Compressor Defaults
>     public static final int DEFAULT_COMPRESSION_LEVEL = 3;
> {code}
> https://github.com/apache/cassandra/commit/dccf53061a61e7c632669c60cd94626e405518e9



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org