Fix a bug of not setting enforce_single_del_contracts (#10027)

Summary:
Before this PR, BuildDBOptions() does not set a newly-added option, i.e.
enforce_single_del_contracts, causing OPTIONS files to contain incorrect
information.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/10027

Test Plan:
make check
Manually check OPTIONS file.

Reviewed By: ltamasi

Differential Revision: D36556125

Pulled By: riversand963

fbshipit-source-id: e1074715b22c328b68c19e9ad89aa5d67d864bb5
This commit is contained in:
Yanqin Jin 2022-05-20 16:48:50 -07:00 committed by Facebook GitHub Bot
parent 2db6a4a1d6
commit f648915b0d
3 changed files with 6 additions and 2 deletions

View File

@ -184,6 +184,8 @@ DBOptions BuildDBOptions(const ImmutableDBOptions& immutable_db_options,
options.checksum_handoff_file_types =
immutable_db_options.checksum_handoff_file_types;
options.lowest_used_cache_tier = immutable_db_options.lowest_used_cache_tier;
options.enforce_single_del_contracts =
immutable_db_options.enforce_single_del_contracts;
return options;
}

View File

@ -355,10 +355,11 @@ TEST_F(OptionsSettableTest, DBOptionsAllFieldsSettable) {
"write_dbid_to_manifest=false;"
"best_efforts_recovery=false;"
"max_bgerror_resume_count=2;"
"bgerror_resume_retry_interval=1000000"
"bgerror_resume_retry_interval=1000000;"
"db_host_id=hostname;"
"lowest_used_cache_tier=kNonVolatileBlockTier;"
"allow_data_in_errors=false",
"allow_data_in_errors=false;"
"enforce_single_del_contracts=false;",
new_options));
ASSERT_EQ(unset_bytes_base, NumUnsetBytes(new_options_ptr, sizeof(DBOptions),

View File

@ -293,6 +293,7 @@ void RandomInitDBOptions(DBOptions* db_opt, Random* rnd) {
db_opt->recycle_log_file_num = rnd->Uniform(2);
db_opt->avoid_flush_during_recovery = rnd->Uniform(2);
db_opt->avoid_flush_during_shutdown = rnd->Uniform(2);
db_opt->enforce_single_del_contracts = rnd->Uniform(2);
// int options
db_opt->max_background_compactions = rnd->Uniform(100);