regression test for missing init options

Summary:
test the `DBOptions(const Options&)` and `ColumnFamilyOptions(const Options&)` constructors. Actually this'll work better once we refactor `RandomInitDBOptions` / `RandomInitCFOptions` to use the authoritative sources of struct members: `db_options_type_info` / `cf_options_type_info` (internal task T21804189 for this).
Closes https://github.com/facebook/rocksdb/pull/2873

Differential Revision: D5817141

Pulled By: ajkr

fbshipit-source-id: 8567c20feced9d1751fdf1f4383e2af30f7e3591
main
Andrew Kryczka 7 years ago committed by Facebook Github Bot
parent f615f5604b
commit 9d115d3689
  1. 2
      options/options_helper.h
  2. 2
      options/options_settable_test.cc
  3. 18
      options/options_test.cc

@ -414,7 +414,7 @@ static std::unordered_map<std::string, OptionTypeInfo> cf_options_type_info = {
OptionType::kBoolean, OptionVerificationType::kNormal, false, 0}}, OptionType::kBoolean, OptionVerificationType::kNormal, false, 0}},
{"purge_redundant_kvs_while_flush", {"purge_redundant_kvs_while_flush",
{offset_of(&ColumnFamilyOptions::purge_redundant_kvs_while_flush), {offset_of(&ColumnFamilyOptions::purge_redundant_kvs_while_flush),
OptionType::kBoolean, OptionVerificationType::kNormal, false, 0}}, OptionType::kBoolean, OptionVerificationType::kDeprecated, false, 0}},
{"verify_checksums_in_compaction", {"verify_checksums_in_compaction",
{0, OptionType::kBoolean, OptionVerificationType::kDeprecated, true, 0}}, {0, OptionType::kBoolean, OptionVerificationType::kDeprecated, true, 0}},
{"soft_pending_compaction_bytes_limit", {"soft_pending_compaction_bytes_limit",

@ -369,6 +369,7 @@ TEST_F(OptionsSettableTest, ColumnFamilyOptionsAllFieldsSettable) {
options->compression_opts = CompressionOptions(); options->compression_opts = CompressionOptions();
options->hard_rate_limit = 0; options->hard_rate_limit = 0;
options->soft_rate_limit = 0; options->soft_rate_limit = 0;
options->purge_redundant_kvs_while_flush = false;
options->compaction_options_fifo = CompactionOptionsFIFO(); options->compaction_options_fifo = CompactionOptionsFIFO();
options->max_mem_compaction_level = 0; options->max_mem_compaction_level = 0;
@ -423,7 +424,6 @@ TEST_F(OptionsSettableTest, ColumnFamilyOptionsAllFieldsSettable) {
"inplace_update_support=false;" "inplace_update_support=false;"
"compaction_style=kCompactionStyleFIFO;" "compaction_style=kCompactionStyleFIFO;"
"compaction_pri=kMinOverlappingRatio;" "compaction_pri=kMinOverlappingRatio;"
"purge_redundant_kvs_while_flush=true;"
"hard_pending_compaction_bytes_limit=0;" "hard_pending_compaction_bytes_limit=0;"
"disable_auto_compactions=false;" "disable_auto_compactions=false;"
"report_bg_io_stats=true;", "report_bg_io_stats=true;",

@ -660,6 +660,24 @@ TEST_F(OptionsTest, DBOptionsSerialization) {
ASSERT_OK(RocksDBOptionsParser::VerifyDBOptions(base_options, new_options)); ASSERT_OK(RocksDBOptionsParser::VerifyDBOptions(base_options, new_options));
} }
TEST_F(OptionsTest, OptionsComposeDecompose) {
// build an Options from DBOptions + CFOptions, then decompose it to verify
// we get same constituent options.
DBOptions base_db_opts;
ColumnFamilyOptions base_cf_opts;
Random rnd(301);
test::RandomInitDBOptions(&base_db_opts, &rnd);
test::RandomInitCFOptions(&base_cf_opts, &rnd);
Options base_opts(base_db_opts, base_cf_opts);
DBOptions new_db_opts(base_opts);
ColumnFamilyOptions new_cf_opts(base_opts);
ASSERT_OK(RocksDBOptionsParser::VerifyDBOptions(base_db_opts, new_db_opts));
ASSERT_OK(RocksDBOptionsParser::VerifyCFOptions(base_cf_opts, new_cf_opts));
}
TEST_F(OptionsTest, ColumnFamilyOptionsSerialization) { TEST_F(OptionsTest, ColumnFamilyOptionsSerialization) {
ColumnFamilyOptions base_opt, new_opt; ColumnFamilyOptions base_opt, new_opt;
Random rnd(302); Random rnd(302);

Loading…
Cancel
Save