L0 compression should follow options.compression_per_level if not empty
Summary: Currently, we don't use options.compression_per_level[0] as the compression style for L0 compression type, unless it is None. This behavior doesn't look like on purpose. This diff will make sure L0 compress using the style of options.compression_per_level[0]. Reviewed and accepted in: https://reviews.facebook.net/D65607 Closes https://github.com/facebook/rocksdb/pull/1435 Differential Revision: D4099368 Pulled By: siying fbshipit-source-id: cfbbdcd
This commit is contained in:
parent
2946cadc46
commit
04751d5345
@ -270,22 +270,17 @@ CompressionType GetCompressionFlush(
|
||||
// Compressing memtable flushes might not help unless the sequential load
|
||||
// optimization is used for leveled compaction. Otherwise the CPU and
|
||||
// latency overhead is not offset by saving much space.
|
||||
|
||||
bool can_compress;
|
||||
|
||||
if (ioptions.compaction_style == kCompactionStyleUniversal) {
|
||||
can_compress =
|
||||
(ioptions.compaction_options_universal.compression_size_percent < 0);
|
||||
if (ioptions.compaction_options_universal.compression_size_percent < 0) {
|
||||
return mutable_cf_options.compression;
|
||||
} else {
|
||||
return kNoCompression;
|
||||
}
|
||||
} else if (!ioptions.compression_per_level.empty()) {
|
||||
// For leveled compress when min_level_to_compress != 0.
|
||||
return ioptions.compression_per_level[0];
|
||||
} else {
|
||||
// For leveled compress when min_level_to_compress == 0.
|
||||
can_compress = ioptions.compression_per_level.empty() ||
|
||||
ioptions.compression_per_level[0] != kNoCompression;
|
||||
}
|
||||
|
||||
if (can_compress) {
|
||||
return mutable_cf_options.compression;
|
||||
} else {
|
||||
return kNoCompression;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user