From d300d10962ac952e0648ecc454b433ff29d6e96f Mon Sep 17 00:00:00 2001 From: Zhichao Cao Date: Mon, 23 Mar 2020 18:47:34 -0700 Subject: [PATCH] Fix the MultiGet testing failure in Circleci (#6578) Summary: The MultiGet test in db_basic_test fails in CircleCI vs2019. The reason is that even Snappy compression is enabled, the first compression type is still kNoCompression. This PR checks the list and ensure that only when compression is enable and the compression type is valid, compression will be enabled. Such that, it will not fail the combined read test in MultiGet. Pull Request resolved: https://github.com/facebook/rocksdb/pull/6578 Test Plan: make check, db_basic_test. Reviewed By: anand1976 Differential Revision: D20607529 Pulled By: zhichao-cao fbshipit-source-id: dcead264d5c2da105912c18caad34b8510bb04b0 --- db/db_basic_test.cc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/db/db_basic_test.cc b/db/db_basic_test.cc index b693264578..dedf938519 100644 --- a/db/db_basic_test.cc +++ b/db/db_basic_test.cc @@ -6,6 +6,7 @@ // Copyright (c) 2011 The LevelDB Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. + #include "db/db_test_util.h" #include "port/stack_trace.h" #include "rocksdb/perf_context.h" @@ -1919,10 +1920,17 @@ class DBBasicTestWithParallelIO 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; + CompressionType tmp_type = kNoCompression; + for (auto c_type : compression_types) { + if (c_type != kNoCompression) { + tmp_type = c_type; + break; + } + } + if (tmp_type != kNoCompression) { + options.compression = tmp_type; } else { - options.compression = compression_types[0]; + compression_enabled_ = false; } } #else @@ -2132,8 +2140,6 @@ class DBBasicTestWithParallelIO bool fill_cache_; }; -// TODO: fails on CircleCI's Windows env -#ifndef OS_WIN TEST_P(DBBasicTestWithParallelIO, MultiGet) { std::vector key_data(10); std::vector keys; @@ -2256,7 +2262,6 @@ TEST_P(DBBasicTestWithParallelIO, MultiGet) { } } } -#endif // OS_WIN TEST_P(DBBasicTestWithParallelIO, MultiGetWithChecksumMismatch) { std::vector key_data(10);