From f648915b0de3aaf276abb3b3277a98dfacfff0eb Mon Sep 17 00:00:00 2001 From: Yanqin Jin Date: Fri, 20 May 2022 16:48:50 -0700 Subject: [PATCH] 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 --- options/options_helper.cc | 2 ++ options/options_settable_test.cc | 5 +++-- test_util/testutil.cc | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/options/options_helper.cc b/options/options_helper.cc index 375cb922b5..99cb0f47fb 100644 --- a/options/options_helper.cc +++ b/options/options_helper.cc @@ -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; } diff --git a/options/options_settable_test.cc b/options/options_settable_test.cc index 3fe65f2adc..7a709178d3 100644 --- a/options/options_settable_test.cc +++ b/options/options_settable_test.cc @@ -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), diff --git a/test_util/testutil.cc b/test_util/testutil.cc index 7b73f7ea51..5e1b909f97 100644 --- a/test_util/testutil.cc +++ b/test_util/testutil.cc @@ -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);