Fix a test failure on systems that don't have Snappy compression libraries (#6038)

Summary:
The ParallelIO/DBBasicTestWithParallelIO.MultiGet/11 test fails if Snappy compression library is not installed, since RocksDB defaults to Snappy if none is specified. So dynamically determine the supported compression types and pick the first one.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6038

Differential Revision: D18532370

Pulled By: anand1976

fbshipit-source-id: a0a735114d1f8892ea09f7c4af8688d7bcc5b075
This commit is contained in:
anand76 2019-11-18 09:35:37 -08:00 committed by Facebook Github Bot
parent f65ec09ef8
commit 5b9233bfe8

View File

@ -1663,6 +1663,19 @@ class DBBasicTestWithParallelIO
Options options = CurrentOptions();
Random rnd(301);
BlockBasedTableOptions table_options;
if (compression_enabled_) {
std::vector<CompressionType> compression_types;
compression_types = GetSupportedCompressions();
// Not every platform may have compression libraries available, so
// dynamically pick based on what's available
if (compression_types.size() == 0) {
compression_enabled_ = false;
} else {
options.compression = compression_types[0];
}
}
table_options.block_cache = uncompressed_cache_;
if (table_options.block_cache == nullptr) {
table_options.no_block_cache = true;