diff options
author | leveldb Team <no-reply@google.com> | 2023-03-30 07:12:55 +0000 |
---|---|---|
committer | Austin Sullivan <asully@chromium.org> | 2023-04-20 18:08:55 +0000 |
commit | c61238dcf39bdcfb6ef27abbda35b4cbf42b9002 (patch) | |
tree | 445a68645c77033ce7d72e9c5116fa4e933108fe /table | |
parent | 77d66aaf3edd6db0f1bfb4308fdc68c62fcc7bf6 (diff) | |
download | leveldb-c61238dcf39bdcfb6ef27abbda35b4cbf42b9002.tar.gz |
Support Zstd compression level in Leveldb
PiperOrigin-RevId: 520556840
Diffstat (limited to 'table')
-rw-r--r-- | table/table_builder.cc | 3 | ||||
-rw-r--r-- | table/table_test.cc | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/table/table_builder.cc b/table/table_builder.cc index ba3df9e..0932c94 100644 --- a/table/table_builder.cc +++ b/table/table_builder.cc @@ -171,7 +171,8 @@ void TableBuilder::WriteBlock(BlockBuilder* block, BlockHandle* handle) { case kZstdCompression: { std::string* compressed = &r->compressed_output; - if (port::Zstd_Compress(raw.data(), raw.size(), compressed) && + if (port::Zstd_Compress(r->options.zstd_compression_level, raw.data(), + raw.size(), compressed) && compressed->size() < raw.size() - (raw.size() / 8u)) { block_contents = *compressed; } else { diff --git a/table/table_test.cc b/table/table_test.cc index b3baf95..aea0697 100644 --- a/table/table_test.cc +++ b/table/table_test.cc @@ -791,7 +791,7 @@ static bool CompressionSupported(CompressionType type) { if (type == kSnappyCompression) { return port::Snappy_Compress(in.data(), in.size(), &out); } else if (type == kZstdCompression) { - return port::Zstd_Compress(in.data(), in.size(), &out); + return port::Zstd_Compress(/*level=*/1, in.data(), in.size(), &out); } return false; } |