From 5b9233bfe815d0e2e827e039e0862309c6b0c2e0 Mon Sep 17 00:00:00 2001 From: anand76 Date: Mon, 18 Nov 2019 09:35:37 -0800 Subject: [PATCH] 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 --- db/db_basic_test.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/db/db_basic_test.cc b/db/db_basic_test.cc index 84111aec42..46bfaaec2b 100644 --- a/db/db_basic_test.cc +++ b/db/db_basic_test.cc @@ -1663,6 +1663,19 @@ class DBBasicTestWithParallelIO Options options = CurrentOptions(); Random rnd(301); BlockBasedTableOptions table_options; + + if (compression_enabled_) { + std::vector 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;