diff --git a/db/db_wal_test.cc b/db/db_wal_test.cc index b903e0f8f..f2f661c30 100644 --- a/db/db_wal_test.cc +++ b/db/db_wal_test.cc @@ -1422,8 +1422,11 @@ TEST_F(DBWALTest, RecoverFromCorruptedWALWithoutFlush) { delete iter; return data; }; - for (auto& mode : wal_recovery_mode_string_map) { - options.wal_recovery_mode = mode.second; + for (auto& mode : {WALRecoveryMode::kTolerateCorruptedTailRecords, + WALRecoveryMode::kAbsoluteConsistency, + WALRecoveryMode::kPointInTimeRecovery, + WALRecoveryMode::kSkipAnyCorruptedRecords}) { + options.wal_recovery_mode = mode; for (auto trunc : {true, false}) { for (int i = 0; i < 4; i++) { for (int j = jstart; j < jend; j++) { diff --git a/options/db_options.cc b/options/db_options.cc index f77cb7b9e..2ce46cad0 100644 --- a/options/db_options.cc +++ b/options/db_options.cc @@ -20,6 +20,29 @@ namespace ROCKSDB_NAMESPACE { #ifndef ROCKSDB_LITE +static std::unordered_map + wal_recovery_mode_string_map = { + {"kTolerateCorruptedTailRecords", + WALRecoveryMode::kTolerateCorruptedTailRecords}, + {"kAbsoluteConsistency", WALRecoveryMode::kAbsoluteConsistency}, + {"kPointInTimeRecovery", WALRecoveryMode::kPointInTimeRecovery}, + {"kSkipAnyCorruptedRecords", + WALRecoveryMode::kSkipAnyCorruptedRecords}}; + +static std::unordered_map + access_hint_string_map = {{"NONE", DBOptions::AccessHint::NONE}, + {"NORMAL", DBOptions::AccessHint::NORMAL}, + {"SEQUENTIAL", DBOptions::AccessHint::SEQUENTIAL}, + {"WILLNEED", DBOptions::AccessHint::WILLNEED}}; + +static std::unordered_map info_log_level_string_map = + {{"DEBUG_LEVEL", InfoLogLevel::DEBUG_LEVEL}, + {"INFO_LEVEL", InfoLogLevel::INFO_LEVEL}, + {"WARN_LEVEL", InfoLogLevel::WARN_LEVEL}, + {"ERROR_LEVEL", InfoLogLevel::ERROR_LEVEL}, + {"FATAL_LEVEL", InfoLogLevel::FATAL_LEVEL}, + {"HEADER_LEVEL", InfoLogLevel::HEADER_LEVEL}}; + std::unordered_map OptionsHelper::db_options_type_info = { /* @@ -247,10 +270,9 @@ std::unordered_map {offsetof(struct DBOptions, allow_concurrent_memtable_write), OptionType::kBoolean, OptionVerificationType::kNormal, OptionTypeFlags::kNone, 0}}, - {"wal_recovery_mode", - {offsetof(struct DBOptions, wal_recovery_mode), - OptionType::kWALRecoveryMode, OptionVerificationType::kNormal, - OptionTypeFlags::kNone, 0}}, + {"wal_recovery_mode", OptionTypeInfo::Enum( + offsetof(struct DBOptions, wal_recovery_mode), + &wal_recovery_mode_string_map)}, {"enable_write_thread_adaptive_yield", {offsetof(struct DBOptions, enable_write_thread_adaptive_yield), OptionType::kBoolean, OptionVerificationType::kNormal, @@ -268,12 +290,12 @@ std::unordered_map OptionType::kUInt64T, OptionVerificationType::kNormal, OptionTypeFlags::kNone, 0}}, {"access_hint_on_compaction_start", - {offsetof(struct DBOptions, access_hint_on_compaction_start), - OptionType::kAccessHint, OptionVerificationType::kNormal, - OptionTypeFlags::kNone, 0}}, - {"info_log_level", - {offsetof(struct DBOptions, info_log_level), OptionType::kInfoLogLevel, - OptionVerificationType::kNormal, OptionTypeFlags::kNone, 0}}, + OptionTypeInfo::Enum( + offsetof(struct DBOptions, access_hint_on_compaction_start), + &access_hint_string_map)}, + {"info_log_level", OptionTypeInfo::Enum( + offsetof(struct DBOptions, info_log_level), + &info_log_level_string_map)}, {"dump_malloc_stats", {offsetof(struct DBOptions, dump_malloc_stats), OptionType::kBoolean, OptionVerificationType::kNormal, OptionTypeFlags::kNone, 0}}, diff --git a/options/options_helper.cc b/options/options_helper.cc index 63e6f6766..33ff268a1 100644 --- a/options/options_helper.cc +++ b/options/options_helper.cc @@ -273,29 +273,6 @@ std::vector GetSupportedCompressions() { #ifndef ROCKSDB_LITE namespace { -template -bool ParseEnum(const std::unordered_map& type_map, - const std::string& type, T* value) { - auto iter = type_map.find(type); - if (iter != type_map.end()) { - *value = iter->second; - return true; - } - return false; -} - -template -bool SerializeEnum(const std::unordered_map& type_map, - const T& type, std::string* value) { - for (const auto& pair : type_map) { - if (pair.second == type) { - *value = pair.first; - return true; - } - } - return false; -} - bool SerializeVectorCompressionType(const std::vector& types, std::string* value) { std::stringstream ss; @@ -535,36 +512,10 @@ bool ParseOptionHelper(char* opt_address, const OptionType& opt_type, return ParseEnum( checksum_type_string_map, value, reinterpret_cast(opt_address)); - case OptionType::kBlockBasedTableIndexType: - return ParseEnum( - block_base_table_index_type_string_map, value, - reinterpret_cast(opt_address)); - case OptionType::kBlockBasedTableDataBlockIndexType: - return ParseEnum( - block_base_table_data_block_index_type_string_map, value, - reinterpret_cast( - opt_address)); - case OptionType::kBlockBasedTableIndexShorteningMode: - return ParseEnum( - block_base_table_index_shortening_mode_string_map, value, - reinterpret_cast( - opt_address)); case OptionType::kEncodingType: return ParseEnum( encoding_type_string_map, value, reinterpret_cast(opt_address)); - case OptionType::kWALRecoveryMode: - return ParseEnum( - wal_recovery_mode_string_map, value, - reinterpret_cast(opt_address)); - case OptionType::kAccessHint: - return ParseEnum( - access_hint_string_map, value, - reinterpret_cast(opt_address)); - case OptionType::kInfoLogLevel: - return ParseEnum( - info_log_level_string_map, value, - reinterpret_cast(opt_address)); case OptionType::kCompactionOptionsFIFO: { if (!FIFOCompactionOptionsSpecialCase( value, reinterpret_cast(opt_address))) { @@ -729,24 +680,6 @@ bool SerializeSingleOptionHelper(const char* opt_address, return SerializeEnum( checksum_type_string_map, *reinterpret_cast(opt_address), value); - case OptionType::kBlockBasedTableIndexType: - return SerializeEnum( - block_base_table_index_type_string_map, - *reinterpret_cast( - opt_address), - value); - case OptionType::kBlockBasedTableDataBlockIndexType: - return SerializeEnum( - block_base_table_data_block_index_type_string_map, - *reinterpret_cast( - opt_address), - value); - case OptionType::kBlockBasedTableIndexShorteningMode: - return SerializeEnum( - block_base_table_index_shortening_mode_string_map, - *reinterpret_cast( - opt_address), - value); case OptionType::kFlushBlockPolicyFactory: { const auto* ptr = reinterpret_cast*>( @@ -758,18 +691,6 @@ bool SerializeSingleOptionHelper(const char* opt_address, return SerializeEnum( encoding_type_string_map, *reinterpret_cast(opt_address), value); - case OptionType::kWALRecoveryMode: - return SerializeEnum( - wal_recovery_mode_string_map, - *reinterpret_cast(opt_address), value); - case OptionType::kAccessHint: - return SerializeEnum( - access_hint_string_map, - *reinterpret_cast(opt_address), value); - case OptionType::kInfoLogLevel: - return SerializeEnum( - info_log_level_string_map, - *reinterpret_cast(opt_address), value); case OptionType::kCompactionOptionsFIFO: return SerializeStruct(opt_address, value, fifo_compaction_options_type_info); @@ -1231,32 +1152,6 @@ Status GetTableFactoryFromMap( return Status::OK(); } -std::unordered_map - OptionsHelper::block_base_table_index_type_string_map = { - {"kBinarySearch", BlockBasedTableOptions::IndexType::kBinarySearch}, - {"kHashSearch", BlockBasedTableOptions::IndexType::kHashSearch}, - {"kTwoLevelIndexSearch", - BlockBasedTableOptions::IndexType::kTwoLevelIndexSearch}, - {"kBinarySearchWithFirstKey", - BlockBasedTableOptions::IndexType::kBinarySearchWithFirstKey}}; - -std::unordered_map - OptionsHelper::block_base_table_data_block_index_type_string_map = { - {"kDataBlockBinarySearch", - BlockBasedTableOptions::DataBlockIndexType::kDataBlockBinarySearch}, - {"kDataBlockBinaryAndHash", - BlockBasedTableOptions::DataBlockIndexType::kDataBlockBinaryAndHash}}; - -std::unordered_map - OptionsHelper::block_base_table_index_shortening_mode_string_map = { - {"kNoShortening", - BlockBasedTableOptions::IndexShorteningMode::kNoShortening}, - {"kShortenSeparators", - BlockBasedTableOptions::IndexShorteningMode::kShortenSeparators}, - {"kShortenSeparatorsAndSuccessor", - BlockBasedTableOptions::IndexShorteningMode:: - kShortenSeparatorsAndSuccessor}}; - std::unordered_map OptionsHelper::encoding_type_string_map = {{"kPlain", kPlain}, {"kPrefix", kPrefix}}; @@ -1275,31 +1170,6 @@ std::unordered_map {"kOldestSmallestSeqFirst", kOldestSmallestSeqFirst}, {"kMinOverlappingRatio", kMinOverlappingRatio}}; -std::unordered_map - OptionsHelper::wal_recovery_mode_string_map = { - {"kTolerateCorruptedTailRecords", - WALRecoveryMode::kTolerateCorruptedTailRecords}, - {"kAbsoluteConsistency", WALRecoveryMode::kAbsoluteConsistency}, - {"kPointInTimeRecovery", WALRecoveryMode::kPointInTimeRecovery}, - {"kSkipAnyCorruptedRecords", - WALRecoveryMode::kSkipAnyCorruptedRecords}}; - -std::unordered_map - OptionsHelper::access_hint_string_map = { - {"NONE", DBOptions::AccessHint::NONE}, - {"NORMAL", DBOptions::AccessHint::NORMAL}, - {"SEQUENTIAL", DBOptions::AccessHint::SEQUENTIAL}, - {"WILLNEED", DBOptions::AccessHint::WILLNEED}}; - -std::unordered_map - OptionsHelper::info_log_level_string_map = { - {"DEBUG_LEVEL", InfoLogLevel::DEBUG_LEVEL}, - {"INFO_LEVEL", InfoLogLevel::INFO_LEVEL}, - {"WARN_LEVEL", InfoLogLevel::WARN_LEVEL}, - {"ERROR_LEVEL", InfoLogLevel::ERROR_LEVEL}, - {"FATAL_LEVEL", InfoLogLevel::FATAL_LEVEL}, - {"HEADER_LEVEL", InfoLogLevel::HEADER_LEVEL}}; - LRUCacheOptions OptionsHelper::dummy_lru_cache_options; CompactionOptionsUniversal OptionsHelper::dummy_comp_options_universal; CompactionOptionsFIFO OptionsHelper::dummy_comp_options; @@ -1510,21 +1380,6 @@ static bool AreOptionsEqual(OptionType type, const char* this_offset, return IsOptionEqual(this_offset, that_offset); case OptionType::kEncodingType: return IsOptionEqual(this_offset, that_offset); - case OptionType::kBlockBasedTableIndexType: - return IsOptionEqual(this_offset, - that_offset); - case OptionType::kBlockBasedTableDataBlockIndexType: - return IsOptionEqual( - this_offset, that_offset); - case OptionType::kBlockBasedTableIndexShorteningMode: - return IsOptionEqual( - this_offset, that_offset); - case OptionType::kWALRecoveryMode: - return IsOptionEqual(this_offset, that_offset); - case OptionType::kAccessHint: - return IsOptionEqual(this_offset, that_offset); - case OptionType::kInfoLogLevel: - return IsOptionEqual(this_offset, that_offset); case OptionType::kCompactionOptionsFIFO: { CompactionOptionsFIFO lhs = *reinterpret_cast(this_offset); diff --git a/options/options_helper.h b/options/options_helper.h index f5450c908..08780e3a6 100644 --- a/options/options_helper.h +++ b/options/options_helper.h @@ -107,25 +107,11 @@ struct OptionsHelper { static std::unordered_map db_options_type_info; static std::unordered_map lru_cache_options_type_info; - static std::unordered_map - block_base_table_index_type_string_map; - static std::unordered_map - block_base_table_data_block_index_type_string_map; - static std::unordered_map - block_base_table_index_shortening_mode_string_map; static std::unordered_map encoding_type_string_map; static std::unordered_map compaction_style_string_map; static std::unordered_map compaction_pri_string_map; - static std::unordered_map - wal_recovery_mode_string_map; - static std::unordered_map - access_hint_string_map; - static std::unordered_map - info_log_level_string_map; static ColumnFamilyOptions dummy_cf_options; static CompactionOptionsFIFO dummy_comp_options; static LRUCacheOptions dummy_lru_cache_options; @@ -153,22 +139,11 @@ static auto& lru_cache_options_type_info = OptionsHelper::lru_cache_options_type_info; static auto& compression_type_string_map = OptionsHelper::compression_type_string_map; -static auto& block_base_table_index_type_string_map = - OptionsHelper::block_base_table_index_type_string_map; -static auto& block_base_table_data_block_index_type_string_map = - OptionsHelper::block_base_table_data_block_index_type_string_map; -static auto& block_base_table_index_shortening_mode_string_map = - OptionsHelper::block_base_table_index_shortening_mode_string_map; static auto& encoding_type_string_map = OptionsHelper::encoding_type_string_map; static auto& compaction_style_string_map = OptionsHelper::compaction_style_string_map; static auto& compaction_pri_string_map = OptionsHelper::compaction_pri_string_map; -static auto& wal_recovery_mode_string_map = - OptionsHelper::wal_recovery_mode_string_map; -static auto& access_hint_string_map = OptionsHelper::access_hint_string_map; -static auto& info_log_level_string_map = - OptionsHelper::info_log_level_string_map; #endif // !ROCKSDB_LITE } // namespace ROCKSDB_NAMESPACE diff --git a/options/options_test.cc b/options/options_test.cc index ca59b5ca1..4002f4630 100644 --- a/options/options_test.cc +++ b/options/options_test.cc @@ -3004,6 +3004,17 @@ static void TestAndCompareOption(const ConfigOptions& config_options, comp_addr, &mismatch)); } +static void TestAndCompareOption(const ConfigOptions& config_options, + const OptionTypeInfo& opt_info, + const std::string& opt_name, + const std::string& opt_value, void* base_ptr, + void* comp_ptr) { + char* base_addr = reinterpret_cast(base_ptr) + opt_info.offset; + ASSERT_OK( + opt_info.ParseOption(config_options, opt_name, opt_value, base_addr)); + TestAndCompareOption(config_options, opt_info, opt_name, base_ptr, comp_ptr); +} + template void TestOptInfo(const ConfigOptions& config_options, OptionType opt_type, T* base, T* comp) { @@ -3264,6 +3275,87 @@ TEST_F(OptionTypeInfoTest, TestOptionFlags) { ASSERT_NE(base, comp); } +TEST_F(OptionTypeInfoTest, TestCustomEnum) { + enum TestEnum { kA, kB, kC }; + std::unordered_map enum_map = { + {"A", TestEnum::kA}, + {"B", TestEnum::kB}, + {"C", TestEnum::kC}, + }; + OptionTypeInfo opt_info = OptionTypeInfo::Enum(0, &enum_map); + TestEnum e1, e2; + ConfigOptions config_options; + std::string result, mismatch; + + e2 = TestEnum::kA; + + ASSERT_OK(opt_info.ParseOption(config_options, "", "B", + reinterpret_cast(&e1))); + ASSERT_OK(opt_info.SerializeOption(config_options, "", + reinterpret_cast(&e1), &result)); + ASSERT_EQ(e1, TestEnum::kB); + ASSERT_EQ(result, "B"); + + ASSERT_FALSE(opt_info.MatchesOption(config_options, "Enum", + reinterpret_cast(&e1), + reinterpret_cast(&e2), &mismatch)); + ASSERT_EQ(mismatch, "Enum"); + + TestAndCompareOption(config_options, opt_info, "", "C", + reinterpret_cast(&e1), + reinterpret_cast(&e2)); + ASSERT_EQ(e2, TestEnum::kC); + + ASSERT_NOK(opt_info.ParseOption(config_options, "", "D", + reinterpret_cast(&e1))); + ASSERT_EQ(e1, TestEnum::kC); +} + +TEST_F(OptionTypeInfoTest, TestBuiltinEnum) { + ConfigOptions config_options; + for (auto iter : OptionsHelper::compaction_style_string_map) { + CompactionStyle e1, e2; + TestAndCompareOption(config_options, + OptionTypeInfo(0, OptionType::kCompactionStyle), + "CompactionStyle", iter.first, &e1, &e2); + ASSERT_EQ(e1, iter.second); + } + for (auto iter : OptionsHelper::compaction_pri_string_map) { + CompactionPri e1, e2; + TestAndCompareOption(config_options, + OptionTypeInfo(0, OptionType::kCompactionPri), + "CompactionPri", iter.first, &e1, &e2); + ASSERT_EQ(e1, iter.second); + } + for (auto iter : OptionsHelper::compression_type_string_map) { + CompressionType e1, e2; + TestAndCompareOption(config_options, + OptionTypeInfo(0, OptionType::kCompressionType), + "CompressionType", iter.first, &e1, &e2); + ASSERT_EQ(e1, iter.second); + } + for (auto iter : OptionsHelper::compaction_stop_style_string_map) { + CompactionStopStyle e1, e2; + TestAndCompareOption(config_options, + OptionTypeInfo(0, OptionType::kCompactionStopStyle), + "CompactionStopStyle", iter.first, &e1, &e2); + ASSERT_EQ(e1, iter.second); + } + for (auto iter : OptionsHelper::checksum_type_string_map) { + ChecksumType e1, e2; + TestAndCompareOption(config_options, + OptionTypeInfo(0, OptionType::kChecksumType), + "CheckSumType", iter.first, &e1, &e2); + ASSERT_EQ(e1, iter.second); + } + for (auto iter : OptionsHelper::encoding_type_string_map) { + EncodingType e1, e2; + TestAndCompareOption(config_options, + OptionTypeInfo(0, OptionType::kEncodingType), + "EncodingType", iter.first, &e1, &e2); + ASSERT_EQ(e1, iter.second); + } +} #endif // !ROCKSDB_LITE } // namespace ROCKSDB_NAMESPACE diff --git a/options/options_type.h b/options/options_type.h index b1769a712..77697c029 100644 --- a/options/options_type.h +++ b/options/options_type.h @@ -41,18 +41,13 @@ enum class OptionType { kCompactionStopStyle, kMergeOperator, kMemTableRepFactory, - kBlockBasedTableIndexType, - kBlockBasedTableDataBlockIndexType, - kBlockBasedTableIndexShorteningMode, kFilterPolicy, kFlushBlockPolicyFactory, kChecksumType, kEncodingType, - kWALRecoveryMode, - kAccessHint, - kInfoLogLevel, kLRUCacheOptions, kEnv, + kEnum, kUnknown, }; @@ -97,6 +92,39 @@ inline OptionTypeFlags operator&(const OptionTypeFlags &a, static_cast(b)); } +// Converts an string into its enumerated value. +// @param type_map Mapping between strings and enum values +// @param type The string representation of the enum +// @param value Returns the enum value represented by the string +// @return true if the string was found in the enum map, false otherwise. +template +bool ParseEnum(const std::unordered_map& type_map, + const std::string& type, T* value) { + auto iter = type_map.find(type); + if (iter != type_map.end()) { + *value = iter->second; + return true; + } + return false; +} + +// Converts an enum into its string representation. +// @param type_map Mapping between strings and enum values +// @param type The enum +// @param value Returned as the string representation of the enum +// @return true if the enum was found in the enum map, false otherwise. +template +bool SerializeEnum(const std::unordered_map& type_map, + const T& type, std::string* value) { + for (const auto& pair : type_map) { + if (pair.second == type) { + *value = pair.first; + return true; + } + } + return false; +} + // Function for converting a option string value into its underlying // representation in "addr" // On success, Status::OK is returned and addr is set to the parsed form @@ -198,6 +226,63 @@ class OptionTypeInfo { verification(_verification), flags(_flags) {} + // Creates an OptionTypeInfo for an enum type. Enums use an additional + // map to convert the enums to/from their string representation. + // To create an OptionTypeInfo that is an Enum, one should: + // - Create a static map of string values to the corresponding enum value + // - Call this method passing the static map in as a parameter. + // Note that it is not necessary to add a new OptionType or make any + // other changes -- the returned object handles parsing, serialiation, and + // comparisons. + // + // @param _offset The offset in the option object for this enum + // @param map The string to enum mapping for this enum + template + static OptionTypeInfo Enum( + int _offset, const std::unordered_map* const map) { + return OptionTypeInfo( + _offset, OptionType::kEnum, OptionVerificationType::kNormal, + OptionTypeFlags::kNone, 0, + // Uses the map argument to convert the input string into + // its corresponding enum value. If value is found in the map, + // addr is updated to the corresponding map entry. + // @return OK if the value is found in the map + // @return InvalidArgument if the value is not found in the map + [map](const ConfigOptions&, const std::string& name, + const std::string& value, char* addr) { + if (map == nullptr) { + return Status::NotSupported("No enum mapping ", name); + } else if (ParseEnum(*map, value, reinterpret_cast(addr))) { + return Status::OK(); + } else { + return Status::InvalidArgument("No mapping for enum ", name); + } + }, + // Uses the map argument to convert the input enum into + // its corresponding string value. If enum value is found in the map, + // value is updated to the corresponding string value in the map. + // @return OK if the enum is found in the map + // @return InvalidArgument if the enum is not found in the map + [map](const ConfigOptions&, const std::string& name, const char* addr, + std::string* value) { + if (map == nullptr) { + return Status::NotSupported("No enum mapping ", name); + } else if (SerializeEnum(*map, (*reinterpret_cast(addr)), + value)) { + return Status::OK(); + } else { + return Status::InvalidArgument("No mapping for enum ", name); + } + }, + // Casts addr1 and addr2 to the enum type and returns true if + // they are equal, false otherwise. + [](const ConfigOptions&, const std::string&, const char* addr1, + const char* addr2, std::string*) { + return (*reinterpret_cast(addr1) == + *reinterpret_cast(addr2)); + }); + } // End OptionTypeInfo::Enum + bool IsEnabled(OptionTypeFlags otf) const { return (flags & otf) == otf; } bool IsMutable() const { return IsEnabled(OptionTypeFlags::kMutable); } diff --git a/table/block_based/block_based_table_factory.cc b/table/block_based/block_based_table_factory.cc index ed3e4c3cd..2a560cae3 100644 --- a/table/block_based/block_based_table_factory.cc +++ b/table/block_based/block_based_table_factory.cc @@ -160,6 +160,34 @@ size_t TailPrefetchStats::GetSuggestedPrefetchSize() { } #ifndef ROCKSDB_LITE +static std::unordered_map + block_base_table_index_type_string_map = { + {"kBinarySearch", BlockBasedTableOptions::IndexType::kBinarySearch}, + {"kHashSearch", BlockBasedTableOptions::IndexType::kHashSearch}, + {"kTwoLevelIndexSearch", + BlockBasedTableOptions::IndexType::kTwoLevelIndexSearch}, + {"kBinarySearchWithFirstKey", + BlockBasedTableOptions::IndexType::kBinarySearchWithFirstKey}}; + +static std::unordered_map + block_base_table_data_block_index_type_string_map = { + {"kDataBlockBinarySearch", + BlockBasedTableOptions::DataBlockIndexType::kDataBlockBinarySearch}, + {"kDataBlockBinaryAndHash", + BlockBasedTableOptions::DataBlockIndexType::kDataBlockBinaryAndHash}}; + +static std::unordered_map + block_base_table_index_shortening_mode_string_map = { + {"kNoShortening", + BlockBasedTableOptions::IndexShorteningMode::kNoShortening}, + {"kShortenSeparators", + BlockBasedTableOptions::IndexShorteningMode::kShortenSeparators}, + {"kShortenSeparatorsAndSuccessor", + BlockBasedTableOptions::IndexShorteningMode:: + kShortenSeparatorsAndSuccessor}}; + static std::unordered_map block_based_table_type_info = { /* currently not supported @@ -185,22 +213,21 @@ static std::unordered_map pin_l0_filter_and_index_blocks_in_cache), OptionType::kBoolean, OptionVerificationType::kNormal, OptionTypeFlags::kNone, 0}}, - {"index_type", - {offsetof(struct BlockBasedTableOptions, index_type), - OptionType::kBlockBasedTableIndexType, - OptionVerificationType::kNormal, OptionTypeFlags::kNone, 0}}, + {"index_type", OptionTypeInfo::Enum( + offsetof(struct BlockBasedTableOptions, index_type), + &block_base_table_index_type_string_map)}, {"hash_index_allow_collision", {offsetof(struct BlockBasedTableOptions, hash_index_allow_collision), OptionType::kBoolean, OptionVerificationType::kNormal, OptionTypeFlags::kNone, 0}}, {"data_block_index_type", - {offsetof(struct BlockBasedTableOptions, data_block_index_type), - OptionType::kBlockBasedTableDataBlockIndexType, - OptionVerificationType::kNormal, OptionTypeFlags::kNone, 0}}, + OptionTypeInfo::Enum( + offsetof(struct BlockBasedTableOptions, data_block_index_type), + &block_base_table_data_block_index_type_string_map)}, {"index_shortening", - {offsetof(struct BlockBasedTableOptions, index_shortening), - OptionType::kBlockBasedTableIndexShorteningMode, - OptionVerificationType::kNormal, OptionTypeFlags::kNone, 0}}, + OptionTypeInfo::Enum( + offsetof(struct BlockBasedTableOptions, index_shortening), + &block_base_table_index_shortening_mode_string_map)}, {"data_block_hash_table_util_ratio", {offsetof(struct BlockBasedTableOptions, data_block_hash_table_util_ratio),