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
main
Zhongyi Xie 6 years ago committed by Facebook Github Bot
parent 4479dff208
commit d51eb0b583
  1. 5
      options/options.cc

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

Loading…
Cancel
Save