提交 9d115d36 编写于 作者: A Andrew Kryczka 提交者: Facebook Github Bot

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
上级 f615f560
......@@ -414,7 +414,7 @@ static std::unordered_map<std::string, OptionTypeInfo> cf_options_type_info = {
OptionType::kBoolean, OptionVerificationType::kNormal, false, 0}},
{"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",
{0, OptionType::kBoolean, OptionVerificationType::kDeprecated, true, 0}},
{"soft_pending_compaction_bytes_limit",
......
......@@ -369,6 +369,7 @@ TEST_F(OptionsSettableTest, ColumnFamilyOptionsAllFieldsSettable) {
options->compression_opts = CompressionOptions();
options->hard_rate_limit = 0;
options->soft_rate_limit = 0;
options->purge_redundant_kvs_while_flush = false;
options->compaction_options_fifo = CompactionOptionsFIFO();
options->max_mem_compaction_level = 0;
......@@ -423,7 +424,6 @@ TEST_F(OptionsSettableTest, ColumnFamilyOptionsAllFieldsSettable) {
"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;"
"report_bg_io_stats=true;",
......
......@@ -660,6 +660,24 @@ TEST_F(OptionsTest, DBOptionsSerialization) {
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) {
ColumnFamilyOptions base_opt, new_opt;
Random rnd(302);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册