From 6483af8ed61e3114eb81e37a64d782da626a4025 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=B2=91=E7=82=AF?= <834727721@qq.com> Date: Thu, 24 Apr 2025 16:13:17 +0800 Subject: [PATCH] Fix the problem that compress level doesn't really take effect using zstd now zstd advanced compress function is only used when compress level is default(1). --- src/include/storage/page_compression_impl.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/include/storage/page_compression_impl.h b/src/include/storage/page_compression_impl.h index a63177082e..a5f2bb5692 100644 --- a/src/include/storage/page_compression_impl.h +++ b/src/include/storage/page_compression_impl.h @@ -1407,8 +1407,9 @@ int TemplateCompressPage(const char* src, char* dst, int dst_size, RelFileCompre level = DEFAULT_ZSTD_COMPRESSION_LEVEL; } #ifndef FRONTEND - bool zstd_with_ctx = t_thrd.page_compression_cxt.zstd_cctx != NULL; - if (!zstd_with_ctx) { + bool zstd_advanced = t_thrd.page_compression_cxt.zstd_cctx != NULL && + level == DEFAULT_ZSTD_COMPRESSION_LEVEL; + if (!zstd_advanced) { compressed_size = ZSTD_compress(data, compressd_buffer_size, compress_src + sizeOfHeaderData, BLCKSZ - sizeOfHeaderData, level); -- Gitee