提交 00d58a37 编写于 作者: P Peter Dillinger 提交者: Facebook Github Bot

Abandon use of folly::Optional (#6036)

Summary:
Had complications with LITE build and valgrind test.
Reverts/fixes small parts of PR https://github.com/facebook/rocksdb/issues/6007
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6036

Test Plan:
make LITE=1 all check
and
ROCKSDB_VALGRIND_RUN=1 DISABLE_JEMALLOC=1 make -j24 db_bloom_filter_test && ROCKSDB_VALGRIND_RUN=1 DISABLE_JEMALLOC=1 ./db_bloom_filter_test

Differential Revision: D18512238

Pulled By: pdillinger

fbshipit-source-id: 37213cf0d309edf11c483fb4b2fb6c02c2cf2b28
上级 6123611c
...@@ -470,7 +470,7 @@ endif() ...@@ -470,7 +470,7 @@ endif()
include_directories(${PROJECT_SOURCE_DIR}) include_directories(${PROJECT_SOURCE_DIR})
include_directories(${PROJECT_SOURCE_DIR}/include) include_directories(${PROJECT_SOURCE_DIR}/include)
include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/third-party/gtest-1.8.1/fused-src) include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/third-party/gtest-1.8.1/fused-src)
if(NOT ROCKSDB_LITE) if(WITH_FOLLY_DISTRIBUTED_MUTEX)
include_directories(${PROJECT_SOURCE_DIR}/third-party/folly) include_directories(${PROJECT_SOURCE_DIR}/third-party/folly)
endif() endif()
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
......
...@@ -320,7 +320,7 @@ else ...@@ -320,7 +320,7 @@ else
PLATFORM_CXXFLAGS += -isystem $(GTEST_DIR) PLATFORM_CXXFLAGS += -isystem $(GTEST_DIR)
endif endif
ifeq ($(filter -DROCKSDB_LITE,$(OPT)),) ifeq ($(USE_FOLLY_DISTRIBUTED_MUTEX),1)
FOLLY_DIR = ./third-party/folly FOLLY_DIR = ./third-party/folly
# AIX: pre-defined system headers are surrounded by an extern "C" block # AIX: pre-defined system headers are surrounded by an extern "C" block
ifeq ($(PLATFORM), OS_AIX) ifeq ($(PLATFORM), OS_AIX)
......
...@@ -77,7 +77,6 @@ ROCKSDB_PREPROCESSOR_FLAGS = [ ...@@ -77,7 +77,6 @@ ROCKSDB_PREPROCESSOR_FLAGS = [
# Directories with files for #include # Directories with files for #include
"-I" + REPO_PATH + "include/", "-I" + REPO_PATH + "include/",
"-I" + REPO_PATH, "-I" + REPO_PATH,
"-I" + REPO_PATH + "third-party/folly/",
] ]
ROCKSDB_ARCH_PREPROCESSOR_FLAGS = { ROCKSDB_ARCH_PREPROCESSOR_FLAGS = {
......
...@@ -83,7 +83,6 @@ ROCKSDB_PREPROCESSOR_FLAGS = [ ...@@ -83,7 +83,6 @@ ROCKSDB_PREPROCESSOR_FLAGS = [
# Directories with files for #include # Directories with files for #include
"-I" + REPO_PATH + "include/", "-I" + REPO_PATH + "include/",
"-I" + REPO_PATH, "-I" + REPO_PATH,
"-I" + REPO_PATH + "third-party/folly/",
] ]
ROCKSDB_ARCH_PREPROCESSOR_FLAGS = { ROCKSDB_ARCH_PREPROCESSOR_FLAGS = {
......
...@@ -7,9 +7,6 @@ ...@@ -7,9 +7,6 @@
// Use of this source code is governed by a BSD-style license that can be // 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. // found in the LICENSE file. See the AUTHORS file for names of contributors.
#ifndef ROCKSDB_LITE
#include <folly/Optional.h>
#endif // ROCKSDB_LITE
#include "db/db_test_util.h" #include "db/db_test_util.h"
#include "port/stack_trace.h" #include "port/stack_trace.h"
#include "rocksdb/perf_context.h" #include "rocksdb/perf_context.h"
...@@ -19,6 +16,12 @@ namespace rocksdb { ...@@ -19,6 +16,12 @@ namespace rocksdb {
namespace { namespace {
using BFP = BloomFilterPolicy; using BFP = BloomFilterPolicy;
namespace BFP2 {
// Extends BFP::Mode with option to use Plain table
using PseudoMode = int;
static constexpr PseudoMode kPlainTable = -1;
} // namespace BFP2
} // namespace } // namespace
// DB tests related to bloom filter. // DB tests related to bloom filter.
...@@ -867,8 +870,7 @@ TEST_F(DBBloomFilterTest, MemtablePrefixBloomOutOfDomain) { ...@@ -867,8 +870,7 @@ TEST_F(DBBloomFilterTest, MemtablePrefixBloomOutOfDomain) {
#ifndef ROCKSDB_LITE #ifndef ROCKSDB_LITE
class BloomStatsTestWithParam class BloomStatsTestWithParam
: public DBBloomFilterTest, : public DBBloomFilterTest,
public testing::WithParamInterface< public testing::WithParamInterface<std::tuple<BFP2::PseudoMode, bool>> {
std::tuple<folly::Optional<BFP::Mode>, bool>> {
public: public:
BloomStatsTestWithParam() { BloomStatsTestWithParam() {
bfp_impl_ = std::get<0>(GetParam()); bfp_impl_ = std::get<0>(GetParam());
...@@ -878,21 +880,22 @@ class BloomStatsTestWithParam ...@@ -878,21 +880,22 @@ class BloomStatsTestWithParam
options_.prefix_extractor.reset(rocksdb::NewFixedPrefixTransform(4)); options_.prefix_extractor.reset(rocksdb::NewFixedPrefixTransform(4));
options_.memtable_prefix_bloom_size_ratio = options_.memtable_prefix_bloom_size_ratio =
8.0 * 1024.0 / static_cast<double>(options_.write_buffer_size); 8.0 * 1024.0 / static_cast<double>(options_.write_buffer_size);
if (bfp_impl_) { if (bfp_impl_ == BFP2::kPlainTable) {
assert(!partition_filters_); // not supported in plain table
PlainTableOptions table_options;
options_.table_factory.reset(NewPlainTableFactory(table_options));
} else {
BlockBasedTableOptions table_options; BlockBasedTableOptions table_options;
table_options.hash_index_allow_collision = false; table_options.hash_index_allow_collision = false;
if (partition_filters_) { if (partition_filters_) {
assert(*bfp_impl_ != BFP::kDeprecatedBlock); assert(bfp_impl_ != BFP::kDeprecatedBlock);
table_options.partition_filters = partition_filters_; table_options.partition_filters = partition_filters_;
table_options.index_type = table_options.index_type =
BlockBasedTableOptions::IndexType::kTwoLevelIndexSearch; BlockBasedTableOptions::IndexType::kTwoLevelIndexSearch;
} }
table_options.filter_policy.reset(new BFP(10, *bfp_impl_)); table_options.filter_policy.reset(
new BFP(10, static_cast<BFP::Mode>(bfp_impl_)));
options_.table_factory.reset(NewBlockBasedTableFactory(table_options)); options_.table_factory.reset(NewBlockBasedTableFactory(table_options));
} else {
assert(!partition_filters_); // not supported in plain table
PlainTableOptions table_options;
options_.table_factory.reset(NewPlainTableFactory(table_options));
} }
options_.env = env_; options_.env = env_;
...@@ -909,7 +912,7 @@ class BloomStatsTestWithParam ...@@ -909,7 +912,7 @@ class BloomStatsTestWithParam
static void SetUpTestCase() {} static void SetUpTestCase() {}
static void TearDownTestCase() {} static void TearDownTestCase() {}
folly::Optional<BFP::Mode> bfp_impl_; BFP2::PseudoMode bfp_impl_;
bool partition_filters_; bool partition_filters_;
Options options_; Options options_;
}; };
...@@ -1030,7 +1033,7 @@ INSTANTIATE_TEST_CASE_P( ...@@ -1030,7 +1033,7 @@ INSTANTIATE_TEST_CASE_P(
std::make_tuple(BFP::kLegacyBloom, true), std::make_tuple(BFP::kLegacyBloom, true),
std::make_tuple(BFP::kFastLocalBloom, false), std::make_tuple(BFP::kFastLocalBloom, false),
std::make_tuple(BFP::kFastLocalBloom, true), std::make_tuple(BFP::kFastLocalBloom, true),
std::make_tuple(folly::Optional<BFP::Mode>(), false))); std::make_tuple(BFP2::kPlainTable, false)));
namespace { namespace {
void PrefixScanInit(DBBloomFilterTest* dbtest) { void PrefixScanInit(DBBloomFilterTest* dbtest) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册