From 5c791323356148fe39844faf04854c7a99877aa5 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 8 Jul 2015 07:35:56 -0700 Subject: [PATCH] Revert the changes related to Options, as requested to seperate them into a different patch. --- include/rocksdb/utilities/convenience.h | 14 ---- table/plain_table_builder.cc | 31 ++++---- table/plain_table_builder.h | 12 ++- table/plain_table_factory.cc | 38 ++++----- table/plain_table_factory.h | 46 ++++++++--- table/plain_table_reader.cc | 22 +++--- table/plain_table_reader.h | 12 +-- util/options_helper.cc | 101 +----------------------- util/options_test.cc | 79 ------------------ 9 files changed, 100 insertions(+), 255 deletions(-) diff --git a/include/rocksdb/utilities/convenience.h b/include/rocksdb/utilities/convenience.h index a82b5cef5..1c1057d3a 100644 --- a/include/rocksdb/utilities/convenience.h +++ b/include/rocksdb/utilities/convenience.h @@ -30,11 +30,6 @@ Status GetBlockBasedTableOptionsFromMap( const std::unordered_map& opts_map, BlockBasedTableOptions* new_table_options); -Status GetPlainTableOptionsFromMap( - const PlainTableOptions& table_options, - const std::unordered_map& opts_map, - PlainTableOptions* new_table_options); - // Take a string representation of option names and values, apply them into the // base_options, and return the new options as a result. The string has the // following format: @@ -53,20 +48,11 @@ Status GetDBOptionsFromString( const std::string& opts_str, DBOptions* new_options); -Status GetPlainTableOptionsFromString( - const PlainTableOptions& table_options, - const std::string& opts_str, - PlainTableOptions* new_table_options); - Status GetBlockBasedTableOptionsFromString( const BlockBasedTableOptions& table_options, const std::string& opts_str, BlockBasedTableOptions* new_table_options); -Status GetMemTableRepFactoryFromString( - const std::string& opts_str, - MemTableRepFactory** new_mem_factory); - Status GetOptionsFromString(const Options& base_options, const std::string& opts_str, Options* new_options); diff --git a/table/plain_table_builder.cc b/table/plain_table_builder.cc index a5537da06..25e1b85bb 100644 --- a/table/plain_table_builder.cc +++ b/table/plain_table_builder.cc @@ -60,32 +60,33 @@ extern const uint64_t kLegacyPlainTableMagicNumber = 0x4f3418eb7a8f13b8ull; PlainTableBuilder::PlainTableBuilder( const ImmutableCFOptions& ioptions, - const std::vector>* int_tbl_prop_collector_factories, - const PlainTableOptions& table_options, - WritableFile* file, uint32_t num_probes) + const std::vector>* + int_tbl_prop_collector_factories, + WritableFile* file, uint32_t user_key_len, EncodingType encoding_type, + size_t index_sparseness, uint32_t bloom_bits_per_key, uint32_t num_probes, + size_t huge_page_tlb_size, double hash_table_ratio, + bool store_index_in_file) : ioptions_(ioptions), bloom_block_(num_probes), file_(file), - bloom_bits_per_key_(table_options.bloom_bits_per_key), - huge_page_tlb_size_(table_options.huge_page_tlb_size), - encoder_(table_options.encoding_type, table_options.user_key_len, - ioptions.prefix_extractor, table_options.index_sparseness), - store_index_in_file_(table_options.store_index_in_file), + bloom_bits_per_key_(bloom_bits_per_key), + huge_page_tlb_size_(huge_page_tlb_size), + encoder_(encoding_type, user_key_len, ioptions.prefix_extractor, + index_sparseness), + store_index_in_file_(store_index_in_file), prefix_extractor_(ioptions.prefix_extractor) { // Build index block and save it in the file if hash_table_ratio > 0 if (store_index_in_file_) { - assert(table_options.hash_table_ratio > 0 || IsTotalOrderMode()); + assert(hash_table_ratio > 0 || IsTotalOrderMode()); index_builder_.reset( - new PlainTableIndexBuilder(&arena_, ioptions, - table_options.index_sparseness, - table_options.hash_table_ratio, - huge_page_tlb_size_)); + new PlainTableIndexBuilder(&arena_, ioptions, index_sparseness, + hash_table_ratio, huge_page_tlb_size_)); assert(bloom_bits_per_key_ > 0); properties_.user_collected_properties [PlainTablePropertyNames::kBloomVersion] = "1"; // For future use } - properties_.fixed_key_len = table_options.user_key_len; + properties_.fixed_key_len = user_key_len; // for plain table, we put all the data in a big chuck. properties_.num_data_blocks = 1; @@ -94,7 +95,7 @@ PlainTableBuilder::PlainTableBuilder( properties_.filter_size = 0; // To support roll-back to previous version, now still use version 0 for // plain encoding. - properties_.format_version = (table_options.encoding_type == kPlain) ? 0 : 1; + properties_.format_version = (encoding_type == kPlain) ? 0 : 1; if (ioptions_.prefix_extractor) { properties_.user_collected_properties diff --git a/table/plain_table_builder.h b/table/plain_table_builder.h index 8fbf4aada..f542d2f60 100644 --- a/table/plain_table_builder.h +++ b/table/plain_table_builder.h @@ -30,10 +30,14 @@ class PlainTableBuilder: public TableBuilder { // caller to close the file after calling Finish(). The output file // will be part of level specified by 'level'. A value of -1 means // that the caller does not know which level the output file will reside. - PlainTableBuilder(const ImmutableCFOptions& ioptions, - const std::vector>* int_tbl_prop_collector_factories, - const PlainTableOptions& table_options, - WritableFile* file, uint32_t num_probes = 6); + PlainTableBuilder( + const ImmutableCFOptions& ioptions, + const std::vector>* + int_tbl_prop_collector_factories, + WritableFile* file, uint32_t user_key_size, EncodingType encoding_type, + size_t index_sparseness, uint32_t bloom_bits_per_key, + uint32_t num_probes = 6, size_t huge_page_tlb_size = 0, + double hash_table_ratio = 0, bool store_index_in_file = false); // REQUIRES: Either Finish() or Abandon() has been called. ~PlainTableBuilder(); diff --git a/table/plain_table_factory.cc b/table/plain_table_factory.cc index 9836ca33e..ee492fa56 100644 --- a/table/plain_table_factory.cc +++ b/table/plain_table_factory.cc @@ -17,11 +17,13 @@ namespace rocksdb { Status PlainTableFactory::NewTableReader(const ImmutableCFOptions& ioptions, const EnvOptions& env_options, const InternalKeyComparator& icomp, - std::unique_ptr&& file, + unique_ptr&& file, uint64_t file_size, - std::unique_ptr* table) const { - return PlainTableReader::Open(ioptions, env_options, table_options_, - icomp, std::move(file), file_size, table); + unique_ptr* table) const { + return PlainTableReader::Open(ioptions, env_options, icomp, std::move(file), + file_size, table, bloom_bits_per_key_, + hash_table_ratio_, index_sparseness_, + huge_page_tlb_size_, full_scan_mode_); } TableBuilder* PlainTableFactory::NewTableBuilder( @@ -31,9 +33,11 @@ TableBuilder* PlainTableFactory::NewTableBuilder( // in-memory dbs. The skip_filters optimization is not useful for plain // tables // - return new PlainTableBuilder(table_builder_options.ioptions, - table_builder_options.int_tbl_prop_collector_factories, - table_options_, file, 6); + return new PlainTableBuilder( + table_builder_options.ioptions, + table_builder_options.int_tbl_prop_collector_factories, file, + user_key_len_, encoding_type_, index_sparseness_, bloom_bits_per_key_, 6, + huge_page_tlb_size_, hash_table_ratio_, store_index_in_file_); } std::string PlainTableFactory::GetPrintableTableOptions() const { @@ -43,36 +47,32 @@ std::string PlainTableFactory::GetPrintableTableOptions() const { char buffer[kBufferSize]; snprintf(buffer, kBufferSize, " user_key_len: %u\n", - table_options_.user_key_len); + user_key_len_); ret.append(buffer); snprintf(buffer, kBufferSize, " bloom_bits_per_key: %d\n", - table_options_.bloom_bits_per_key); + bloom_bits_per_key_); ret.append(buffer); snprintf(buffer, kBufferSize, " hash_table_ratio: %lf\n", - table_options_.hash_table_ratio); + hash_table_ratio_); ret.append(buffer); snprintf(buffer, kBufferSize, " index_sparseness: %" ROCKSDB_PRIszt "\n", - table_options_.index_sparseness); + index_sparseness_); ret.append(buffer); snprintf(buffer, kBufferSize, " huge_page_tlb_size: %" ROCKSDB_PRIszt "\n", - table_options_.huge_page_tlb_size); + huge_page_tlb_size_); ret.append(buffer); snprintf(buffer, kBufferSize, " encoding_type: %d\n", - table_options_.encoding_type); + encoding_type_); ret.append(buffer); snprintf(buffer, kBufferSize, " full_scan_mode: %d\n", - table_options_.full_scan_mode); + full_scan_mode_); ret.append(buffer); snprintf(buffer, kBufferSize, " store_index_in_file: %d\n", - table_options_.store_index_in_file); + store_index_in_file_); ret.append(buffer); return ret; } -const PlainTableOptions& PlainTableFactory::GetTableOptions() const { - return table_options_; -} - extern TableFactory* NewPlainTableFactory(const PlainTableOptions& options) { return new PlainTableFactory(options); } diff --git a/table/plain_table_factory.h b/table/plain_table_factory.h index 115a3f61c..730e13468 100644 --- a/table/plain_table_factory.h +++ b/table/plain_table_factory.h @@ -127,18 +127,37 @@ class TableBuilder; class PlainTableFactory : public TableFactory { public: ~PlainTableFactory() {} - - explicit PlainTableFactory( - const PlainTableOptions& table_options = PlainTableOptions()) - : table_options_(table_options) {} - + // user_key_len is the length of the user key. If it is set to be + // kPlainTableVariableLength, then it means variable length. Otherwise, all + // the keys need to have the fix length of this value. bloom_bits_per_key is + // number of bits used for bloom filer per key. hash_table_ratio is + // the desired utilization of the hash table used for prefix hashing. + // hash_table_ratio = number of prefixes / #buckets in the hash table + // hash_table_ratio = 0 means skip hash table but only replying on binary + // search. + // index_sparseness determines index interval for keys + // inside the same prefix. It will be the maximum number of linear search + // required after hash and binary search. + // index_sparseness = 0 means index for every key. + // huge_page_tlb_size determines whether to allocate hash indexes from huge + // page TLB and the page size if allocating from there. See comments of + // Arena::AllocateAligned() for details. + explicit PlainTableFactory(const PlainTableOptions& options = + PlainTableOptions()) + : user_key_len_(options.user_key_len), + bloom_bits_per_key_(options.bloom_bits_per_key), + hash_table_ratio_(options.hash_table_ratio), + index_sparseness_(options.index_sparseness), + huge_page_tlb_size_(options.huge_page_tlb_size), + encoding_type_(options.encoding_type), + full_scan_mode_(options.full_scan_mode), + store_index_in_file_(options.store_index_in_file) {} const char* Name() const override { return "PlainTable"; } Status NewTableReader( const ImmutableCFOptions& options, const EnvOptions& soptions, const InternalKeyComparator& internal_comparator, - std::unique_ptr&& file, uint64_t file_size, - std::unique_ptr* table) const override; - + unique_ptr&& file, uint64_t file_size, + unique_ptr* table) const override; TableBuilder* NewTableBuilder( const TableBuilderOptions& table_builder_options, WritableFile* file) const override; @@ -157,10 +176,15 @@ class PlainTableFactory : public TableFactory { return Status::OK(); } - const PlainTableOptions& GetTableOptions() const; - private: - PlainTableOptions table_options_; + uint32_t user_key_len_; + int bloom_bits_per_key_; + double hash_table_ratio_; + size_t index_sparseness_; + size_t huge_page_tlb_size_; + EncodingType encoding_type_; + bool full_scan_mode_; + bool store_index_in_file_; }; } // namespace rocksdb diff --git a/table/plain_table_reader.cc b/table/plain_table_reader.cc index e30a49706..c409204aa 100644 --- a/table/plain_table_reader.cc +++ b/table/plain_table_reader.cc @@ -90,7 +90,7 @@ class PlainTableIterator : public Iterator { extern const uint64_t kPlainTableMagicNumber; PlainTableReader::PlainTableReader(const ImmutableCFOptions& ioptions, - std::unique_ptr&& file, + unique_ptr&& file, const EnvOptions& storage_options, const InternalKeyComparator& icomparator, EncodingType encoding_type, @@ -114,11 +114,13 @@ PlainTableReader::~PlainTableReader() { Status PlainTableReader::Open(const ImmutableCFOptions& ioptions, const EnvOptions& env_options, - const PlainTableOptions& table_options, const InternalKeyComparator& internal_comparator, - std::unique_ptr&& file, + unique_ptr&& file, uint64_t file_size, - std::unique_ptr* table_reader) { + unique_ptr* table_reader, + const int bloom_bits_per_key, + double hash_table_ratio, size_t index_sparseness, + size_t huge_page_tlb_size, bool full_scan_mode) { assert(ioptions.allow_mmap_reads); if (file_size > PlainTableIndex::kMaxFileSize) { return Status::NotSupported("File is too large for PlainTableReader!"); @@ -131,12 +133,12 @@ Status PlainTableReader::Open(const ImmutableCFOptions& ioptions, return s; } - assert(table_options.hash_table_ratio >= 0.0); + assert(hash_table_ratio >= 0.0); auto& user_props = props->user_collected_properties; auto prefix_extractor_in_file = user_props.find(PlainTablePropertyNames::kPrefixExtractorName); - if (!table_options.full_scan_mode && prefix_extractor_in_file != user_props.end()) { + if (!full_scan_mode && prefix_extractor_in_file != user_props.end()) { if (!ioptions.prefix_extractor) { return Status::InvalidArgument( "Prefix extractor is missing when opening a PlainTable built " @@ -166,11 +168,9 @@ Status PlainTableReader::Open(const ImmutableCFOptions& ioptions, return s; } - if (!table_options.full_scan_mode) { - s = new_reader->PopulateIndex(props, table_options.bloom_bits_per_key, - table_options.hash_table_ratio, - table_options.index_sparseness, - table_options.huge_page_tlb_size); + if (!full_scan_mode) { + s = new_reader->PopulateIndex(props, bloom_bits_per_key, hash_table_ratio, + index_sparseness, huge_page_tlb_size); if (!s.ok()) { return s; } diff --git a/table/plain_table_reader.h b/table/plain_table_reader.h index b0812e6b7..b4f68a0fd 100644 --- a/table/plain_table_reader.h +++ b/table/plain_table_reader.h @@ -55,10 +55,12 @@ class PlainTableReader: public TableReader { public: static Status Open(const ImmutableCFOptions& ioptions, const EnvOptions& env_options, - const PlainTableOptions& table_options, const InternalKeyComparator& internal_comparator, - std::unique_ptr&& file, uint64_t file_size, - std::unique_ptr* table); + unique_ptr&& file, uint64_t file_size, + unique_ptr* table, + const int bloom_bits_per_key, double hash_table_ratio, + size_t index_sparseness, size_t huge_page_tlb_size, + bool full_scan_mode); Iterator* NewIterator(const ReadOptions&, Arena* arena = nullptr) override; @@ -81,7 +83,7 @@ class PlainTableReader: public TableReader { } PlainTableReader(const ImmutableCFOptions& ioptions, - std::unique_ptr&& file, + unique_ptr&& file, const EnvOptions& env_options, const InternalKeyComparator& internal_comparator, EncodingType encoding_type, uint64_t file_size, @@ -132,7 +134,7 @@ class PlainTableReader: public TableReader { Arena arena_; const ImmutableCFOptions& ioptions_; - std::unique_ptr file_; + unique_ptr file_; uint64_t file_size_; std::shared_ptr table_properties_; diff --git a/util/options_helper.cc b/util/options_helper.cc index fdbedc7cd..72db57dc5 100644 --- a/util/options_helper.cc +++ b/util/options_helper.cc @@ -10,16 +10,13 @@ #include "rocksdb/cache.h" #include "rocksdb/filter_policy.h" #include "rocksdb/options.h" -#include "rocksdb/memtablerep.h" #include "rocksdb/rate_limiter.h" #include "rocksdb/slice_transform.h" #include "rocksdb/table.h" #include "rocksdb/utilities/convenience.h" #include "table/block_based_table_factory.h" -#include "table/plain_table_factory.h" #include "util/logging.h" #include "util/options_helper.h" -#include "util/string_util.h" namespace rocksdb { @@ -269,7 +266,7 @@ Status GetMutableOptionsFromStrings( return Status::InvalidArgument( "unsupported dynamic option: " + o.first); } - } catch (const std::exception& e) { + } catch (std::exception& e) { return Status::InvalidArgument("error parsing " + o.first + ":" + std::string(e.what())); } @@ -394,27 +391,6 @@ bool ParseColumnFamilyOption(const std::string& name, const std::string& value, return false; } new_options->table_factory.reset(NewBlockBasedTableFactory(table_opt)); - } else if (name == "plain_table_factory") { - PlainTableOptions table_opt, base_table_options; - auto plain_table_factory = dynamic_cast( - new_options->table_factory.get()); - if (plain_table_factory != nullptr) { - base_table_options = plain_table_factory->GetTableOptions(); - } - Status table_opt_s = GetPlainTableOptionsFromString( - base_table_options, value, &table_opt); - if (!table_opt_s.ok()) { - return false; - } - new_options->table_factory.reset(NewPlainTableFactory(table_opt)); - } else if (name == "memtablerep") { - MemTableRepFactory* new_mem_factory; - Status mem_factory_s = - GetMemTableRepFactoryFromString(value, &new_mem_factory); - if (!mem_factory_s.ok()) { - return false; - } - new_options->memtable_factory.reset(new_mem_factory); } else if (name == "min_write_buffer_number_to_merge") { new_options->min_write_buffer_number_to_merge = ParseInt(value); } else if (name == "max_write_buffer_number_to_maintain") { @@ -505,7 +481,7 @@ bool ParseColumnFamilyOption(const std::string& name, const std::string& value, return false; } } - catch (const std::exception& e) { + catch (std::exception& e) { return false; } return true; @@ -653,7 +629,7 @@ Status GetBlockBasedTableOptionsFromMap( } else { return Status::InvalidArgument("Unrecognized option: " + o.first); } - } catch (const std::exception& e) { + } catch (std::exception& e) { return Status::InvalidArgument("error parsing " + o.first + ":" + std::string(e.what())); } @@ -708,7 +684,7 @@ Status GetPlainTableOptionsFromMap( } else { return Status::InvalidArgument("Unrecognized option: " + o.first); } - } catch (const std::exception& e) { + } catch (std::exception& e) { return Status::InvalidArgument("error parsing " + o.first + ":" + std::string(e.what())); } @@ -716,75 +692,6 @@ Status GetPlainTableOptionsFromMap( return Status::OK(); } -Status GetPlainTableOptionsFromString( - const PlainTableOptions& table_options, - const std::string& opts_str, - PlainTableOptions* new_table_options) { - std::unordered_map opts_map; - Status s = StringToMap(opts_str, &opts_map); - if (!s.ok()) { - return s; - } - return GetPlainTableOptionsFromMap(table_options, opts_map, - new_table_options); -} - -Status GetMemTableRepFactoryFromString( - const std::string& opts_str, - MemTableRepFactory** new_mem_factory) { - std::vector opts_list = StringSplit(opts_str, ':'); - size_t len = opts_list.size(); - if (opts_list[0] == "skip_list") { - // Expecting format - // skip_list:lookahead - if (2 == len) { - size_t lookahead = ParseSizeT(opts_list[1]); - *new_mem_factory = new SkipListFactory(lookahead); - } else if (1 == len) { - *new_mem_factory = new SkipListFactory(); - } else { - return Status::InvalidArgument("Can't parse option ", opts_str); - } - } else if (opts_list[0] == "prefix_hash") { - // Expecting format - // prfix_hash:hash_bucket_count - if (2 == len) { - size_t hash_bucket_count = ParseSizeT(opts_list[1]); - *new_mem_factory = NewHashSkipListRepFactory(hash_bucket_count); - } else if (1 == len) { - *new_mem_factory = NewHashSkipListRepFactory(); - } else { - return Status::InvalidArgument("Can't parse option ", opts_str); - } - } else if (opts_list[0] == "hash_linkedlist") { - // Expecting format - // hash_linkedlist:hash_bucket_count - if (2 == len) { - size_t hash_bucket_count = ParseSizeT(opts_list[1]); - *new_mem_factory = NewHashLinkListRepFactory(hash_bucket_count); - } else if (1 == len) { - *new_mem_factory = NewHashLinkListRepFactory(); - } else { - return Status::InvalidArgument("Can't parse option ", opts_str); - } - } else if (opts_list[0] == "vector") { - if (1 == len) { - *new_mem_factory = new VectorRepFactory; - } else { - return Status::InvalidArgument("Can't parse option ", opts_str); - } - } else if (opts_list[0] == "cuckoo") { - return Status::InvalidArgument("cuckoo is not supported for now"); - // TODO(bahuang): cuckoo is not supported for now - // *new_mem_factory = NewHashCuckooRepFactory( - // options.write_buffer_size, FLAGS_key_size + FLAGS_value_size)); - } else { - return Status::InvalidArgument("Can't parse option " + opts_str); - } - return Status::OK(); -} - - Status GetColumnFamilyOptionsFromMap( const ColumnFamilyOptions& base_options, const std::unordered_map& opts_map, diff --git a/util/options_test.cc b/util/options_test.cc index 3d8a84b99..60a4bd9be 100644 --- a/util/options_test.cc +++ b/util/options_test.cc @@ -16,12 +16,10 @@ #include "rocksdb/cache.h" #include "rocksdb/options.h" -#include "rocksdb/memtablerep.h" #include "rocksdb/table.h" #include "rocksdb/utilities/convenience.h" #include "rocksdb/utilities/leveldb_options.h" #include "table/block_based_table_factory.h" -#include "table/plain_table_factory.h" #include "util/random.h" #include "util/testharness.h" @@ -421,18 +419,6 @@ TEST_F(OptionsTest, GetColumnFamilyOptionsFromStringTest) { ASSERT_NOK(GetColumnFamilyOptionsFromString(base_cf_opt, "optimize_filters_for_hits=junk", &new_cf_opt)); - - // Parsing PlainTableOption - ASSERT_OK(GetColumnFamilyOptionsFromString( - base_cf_opt, - "plain_table_factory={user_key_len=16;bloom_bits_per_key=10;};", - &new_cf_opt)); - - // Paring Memtable Factory Options - ASSERT_OK(GetColumnFamilyOptionsFromString( - base_cf_opt, - "memtablerep=prefix_hash;", - &new_cf_opt)); } #endif // !ROCKSDB_LITE @@ -491,71 +477,6 @@ TEST_F(OptionsTest, GetBlockBasedTableOptionsFromString) { } #endif // !ROCKSDB_LITE -#ifndef ROCKSDB_LITE // GetPlainTableOptionsFromString is not supported -TEST_F(OptionsTest, GetPlainTableOptionsFromString){ - PlainTableOptions table_opt; - PlainTableOptions new_opt; - // make sure default values are overwritten by something else - ASSERT_OK(GetPlainTableOptionsFromString(table_opt, - "user_key_len=16;bloom_bits_per_key=8;hash_table_ratio=0.5;" - "index_sparseness=8;huge_page_tlb_size=20;encoding_type=kPrefix;" - "full_scan_mode=1;store_index_in_file=1", - &new_opt)); - ASSERT_EQ(new_opt.user_key_len, 16); - ASSERT_EQ(new_opt.bloom_bits_per_key, 8); - ASSERT_EQ(new_opt.hash_table_ratio, 0.5); - ASSERT_EQ(new_opt.index_sparseness, 8); - ASSERT_EQ(new_opt.huge_page_tlb_size, 20); - ASSERT_EQ(new_opt.encoding_type, kPrefix); - ASSERT_TRUE(new_opt.full_scan_mode); - ASSERT_TRUE(new_opt.store_index_in_file); - - // unknown options - ASSERT_NOK(GetPlainTableOptionsFromString(table_opt, - "user_key_len=16;bloom_bits_per_key=8;bad_option=1", - &new_opt)); - - // unknown encoding type - ASSERT_NOK(GetPlainTableOptionsFromString(table_opt, - "user_key_len=16;bloom_bits_per_key=8;encoding_type=kPrefixXX", - &new_opt)); -} -#endif // !ROCKSDB_LITE - -#ifndef ROCKSDB_LITE // GetMemTableRepFactoryFromString is not supported -TEST_F(OptionsTest, GetMemTableRepFactoryFromString) { - MemTableRepFactory* new_mem_factory = nullptr; - - ASSERT_OK(GetMemTableRepFactoryFromString( - "skip_list", &new_mem_factory)); - ASSERT_OK(GetMemTableRepFactoryFromString( - "skip_list:16", &new_mem_factory)); - ASSERT_EQ(std::string(new_mem_factory->Name()), "SkipListFactory"); - - ASSERT_OK(GetMemTableRepFactoryFromString( - "prefix_hash", &new_mem_factory)); - ASSERT_OK(GetMemTableRepFactoryFromString( - "prefix_hash:1000", &new_mem_factory)); - ASSERT_EQ(std::string(new_mem_factory->Name()), "HashSkipListRepFactory"); - - ASSERT_OK(GetMemTableRepFactoryFromString( - "hash_linkedlist", &new_mem_factory)); - ASSERT_OK(GetMemTableRepFactoryFromString( - "hash_linkedlist:1000", &new_mem_factory)); - ASSERT_EQ(std::string(new_mem_factory->Name()), "HashLinkListRepFactory"); - - ASSERT_OK(GetMemTableRepFactoryFromString( - "vector", &new_mem_factory)); - ASSERT_EQ(std::string(new_mem_factory->Name()), "VectorRepFactory"); - - ASSERT_NOK(GetMemTableRepFactoryFromString( - "invalid_factory", &new_mem_factory)); - - ASSERT_NOK(GetMemTableRepFactoryFromString( - "skip_list:16:invalid_opt", &new_mem_factory)); -} -#endif // !ROCKSDB_LITE - #ifndef ROCKSDB_LITE // GetOptionsFromString is not supported in RocksDB Lite TEST_F(OptionsTest, GetOptionsFromStringTest) { Options base_options, new_options;