Beihao-Zhou commented on code in PR #2171:
URL: https://github.com/apache/kvrocks/pull/2171#discussion_r1526711453
##########
src/config/config.cc:
##########
@@ -190,6 +190,7 @@ Config::Config() {
{"rocksdb.compression", false,
new EnumField<rocksdb::CompressionType>(&rocks_db.compression,
compression_types,
rocksdb::CompressionType::kNoCompression)},
+ {"rocksdb.compression_level", true, new
IntField(&rocks_db.compression_level, 32767, INT_MIN, INT_MAX)},
Review Comment:
Oh gotcha, nwnw, I did have the same question while I was working on it.
So when we change the compression type, it doesn't require re-encoding of
the existing data because each block or SST file includes metadata specifying
the compression algorithm used for that particular block or file. This allows
RocksDB to understand how to decompress the data regardless of the global
compression settings at any given time.
However, compression level, unlike compression types, which are recorded and
recognized on a per-block or per-file basis, the specific level detail isn't
stored with each block or file. Therefore, if we want to change it, it will
require re-encoding everything, which is a huge overhead. I think that's the
reason why RocksDB doesn't allow us to dynamically SetOption() for it.
Ref: https://github.com/facebook/rocksdb/wiki/Compression (The first line
explains a bit about the granularity of encoding block)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]