Make compaction_pri settable through option string
Summary: Closes https://github.com/facebook/rocksdb/pull/1941 Differential Revision: D4637253 Pulled By: siying fbshipit-source-id: a59dcdb
This commit is contained in:
parent
32be357ef7
commit
4dd267d497
@ -536,6 +536,10 @@ bool ParseOptionHelper(char* opt_address, const OptionType& opt_type,
|
||||
return ParseEnum<CompactionStyle>(
|
||||
compaction_style_string_map, value,
|
||||
reinterpret_cast<CompactionStyle*>(opt_address));
|
||||
case OptionType::kCompactionPri:
|
||||
return ParseEnum<CompactionPri>(
|
||||
compaction_pri_string_map, value,
|
||||
reinterpret_cast<CompactionPri*>(opt_address));
|
||||
case OptionType::kCompressionType:
|
||||
return ParseEnum<CompressionType>(
|
||||
compression_type_string_map, value,
|
||||
@ -617,6 +621,10 @@ bool SerializeSingleOptionHelper(const char* opt_address,
|
||||
return SerializeEnum<CompactionStyle>(
|
||||
compaction_style_string_map,
|
||||
*(reinterpret_cast<const CompactionStyle*>(opt_address)), value);
|
||||
case OptionType::kCompactionPri:
|
||||
return SerializeEnum<CompactionPri>(
|
||||
compaction_pri_string_map,
|
||||
*(reinterpret_cast<const CompactionPri*>(opt_address)), value);
|
||||
case OptionType::kCompressionType:
|
||||
return SerializeEnum<CompressionType>(
|
||||
compression_type_string_map,
|
||||
|
@ -106,6 +106,7 @@ enum class OptionType {
|
||||
kString,
|
||||
kDouble,
|
||||
kCompactionStyle,
|
||||
kCompactionPri,
|
||||
kSliceTransform,
|
||||
kCompressionType,
|
||||
kVectorCompressionType,
|
||||
@ -573,8 +574,10 @@ static std::unordered_map<std::string, OptionTypeInfo> cf_options_type_info = {
|
||||
OptionType::kMergeOperator, OptionVerificationType::kByName, false, 0}},
|
||||
{"compaction_style",
|
||||
{offsetof(struct ColumnFamilyOptions, compaction_style),
|
||||
OptionType::kCompactionStyle, OptionVerificationType::kNormal, false,
|
||||
0}}};
|
||||
OptionType::kCompactionStyle, OptionVerificationType::kNormal, false, 0}},
|
||||
{"compaction_pri",
|
||||
{offsetof(struct ColumnFamilyOptions, compaction_pri),
|
||||
OptionType::kCompactionPri, OptionVerificationType::kNormal, false, 0}}};
|
||||
|
||||
static std::unordered_map<std::string, OptionTypeInfo>
|
||||
block_based_table_type_info = {
|
||||
@ -706,6 +709,13 @@ static std::unordered_map<std::string, CompactionStyle>
|
||||
{"kCompactionStyleFIFO", kCompactionStyleFIFO},
|
||||
{"kCompactionStyleNone", kCompactionStyleNone}};
|
||||
|
||||
static std::unordered_map<std::string, CompactionPri>
|
||||
compaction_pri_string_map = {
|
||||
{"kByCompensatedSize", kByCompensatedSize},
|
||||
{"kOldestLargestSeqFirst", kOldestLargestSeqFirst},
|
||||
{"kOldestSmallestSeqFirst", kOldestSmallestSeqFirst},
|
||||
{"kMinOverlappingRatio", kMinOverlappingRatio}};
|
||||
|
||||
static std::unordered_map<std::string,
|
||||
WALRecoveryMode> wal_recovery_mode_string_map = {
|
||||
{"kTolerateCorruptedTailRecords",
|
||||
|
@ -542,6 +542,9 @@ bool AreEqualOptions(
|
||||
case OptionType::kCompactionStyle:
|
||||
return (*reinterpret_cast<const CompactionStyle*>(offset1) ==
|
||||
*reinterpret_cast<const CompactionStyle*>(offset2));
|
||||
case OptionType::kCompactionPri:
|
||||
return (*reinterpret_cast<const CompactionPri*>(offset1) ==
|
||||
*reinterpret_cast<const CompactionPri*>(offset2));
|
||||
case OptionType::kCompressionType:
|
||||
return (*reinterpret_cast<const CompressionType*>(offset1) ==
|
||||
*reinterpret_cast<const CompressionType*>(offset2));
|
||||
|
@ -373,7 +373,6 @@ TEST_F(OptionsSettableTest, ColumnFamilyOptionsAllFieldsSettable) {
|
||||
// Following options are not settable through
|
||||
// GetColumnFamilyOptionsFromString():
|
||||
options->rate_limit_delay_max_milliseconds = 33;
|
||||
options->compaction_pri = CompactionPri::kOldestSmallestSeqFirst;
|
||||
options->compaction_options_universal = CompactionOptionsUniversal();
|
||||
options->compression_opts = CompressionOptions();
|
||||
options->hard_rate_limit = 0;
|
||||
@ -433,6 +432,7 @@ TEST_F(OptionsSettableTest, ColumnFamilyOptionsAllFieldsSettable) {
|
||||
"level_compaction_dynamic_level_bytes=false;"
|
||||
"inplace_update_support=false;"
|
||||
"compaction_style=kCompactionStyleFIFO;"
|
||||
"compaction_pri=kMinOverlappingRatio;"
|
||||
"purge_redundant_kvs_while_flush=true;"
|
||||
"hard_pending_compaction_bytes_limit=0;"
|
||||
"disable_auto_compactions=false;"
|
||||
|
@ -77,6 +77,7 @@ TEST_F(OptionsTest, GetOptionsFromMapTest) {
|
||||
{"arena_block_size", "22"},
|
||||
{"disable_auto_compactions", "true"},
|
||||
{"compaction_style", "kCompactionStyleLevel"},
|
||||
{"compaction_pri", "kOldestSmallestSeqFirst"},
|
||||
{"verify_checksums_in_compaction", "false"},
|
||||
{"compaction_options_fifo", "23"},
|
||||
{"max_sequential_skip_in_iterations", "24"},
|
||||
@ -176,6 +177,7 @@ TEST_F(OptionsTest, GetOptionsFromMapTest) {
|
||||
ASSERT_EQ(new_cf_opt.disable_auto_compactions, true);
|
||||
ASSERT_EQ(new_cf_opt.compaction_style, kCompactionStyleLevel);
|
||||
ASSERT_EQ(new_cf_opt.verify_checksums_in_compaction, false);
|
||||
ASSERT_EQ(new_cf_opt.compaction_pri, kOldestSmallestSeqFirst);
|
||||
ASSERT_EQ(new_cf_opt.compaction_options_fifo.max_table_files_size,
|
||||
static_cast<uint64_t>(23));
|
||||
ASSERT_EQ(new_cf_opt.max_sequential_skip_in_iterations,
|
||||
|
Loading…
Reference in New Issue
Block a user