set snappy compression only when supported (#4325)

Summary:
Right now `OptimizeLevelStyleCompaction` may set compression type to Snappy even when Snappy is not supported, this may cause errors like "no snappy compression support"
Fixes https://github.com/facebook/rocksdb/issues/4283
Pull Request resolved: https://github.com/facebook/rocksdb/pull/4325

Differential Revision: D15125542

Pulled By: miasantreble

fbshipit-source-id: 70890b73ababe16752721555dbd290633c2aafac
This commit is contained in:
Zhongyi Xie 2019-05-01 20:36:09 -07:00 committed by Facebook Github Bot
parent 4479dff208
commit d51eb0b583

View File

@ -548,7 +548,10 @@ ColumnFamilyOptions* ColumnFamilyOptions::OptimizeLevelStyleCompaction(
if (i < 2) {
compression_per_level[i] = kNoCompression;
} else {
compression_per_level[i] = kSnappyCompression;
compression_per_level[i] =
LZ4_Supported()
? kLZ4Compression
: (Snappy_Supported() ? kSnappyCompression : kNoCompression);
}
}
return this;