Skip to content

Commit

Permalink
Fix a test failure on systems that don't have Snappy compression libr…
Browse files Browse the repository at this point in the history
…aries (facebook#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: facebook#6038

Differential Revision: D18532370

Pulled By: anand1976

fbshipit-source-id: a0a735114d1f8892ea09f7c4af8688d7bcc5b075
  • Loading branch information
anand76 authored and facebook-github-bot committed Nov 18, 2019
1 parent 464a20a commit 147e01b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions db/db_basic_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 147e01b

Please sign in to comment.