From d51eb0b583fe28ede2b4a6d778de4489433f1bbf Mon Sep 17 00:00:00 2001 From: Zhongyi Xie Date: Wed, 1 May 2019 20:36:09 -0700 Subject: [PATCH] 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 --- options/options.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/options/options.cc b/options/options.cc index bfe3e313d..5e0c539af 100644 --- a/options/options.cc +++ b/options/options.cc @@ -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;