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
main
anand76 5 years ago committed by Facebook Github Bot
parent f65ec09ef8
commit 5b9233bfe8
  1. 13
      db/db_basic_test.cc

@ -1663,6 +1663,19 @@ class DBBasicTestWithParallelIO
Options options = CurrentOptions(); Options options = CurrentOptions();
Random rnd(301); Random rnd(301);
BlockBasedTableOptions table_options; 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_; table_options.block_cache = uncompressed_cache_;
if (table_options.block_cache == nullptr) { if (table_options.block_cache == nullptr) {
table_options.no_block_cache = true; table_options.no_block_cache = true;

Loading…
Cancel
Save