diff --git a/db/column_family.cc b/db/column_family.cc index 5349b637a..9bb89ebac 100644 --- a/db/column_family.cc +++ b/db/column_family.cc @@ -1148,8 +1148,9 @@ void ColumnFamilyData::ResetThreadLocalSuperVersions() { Status ColumnFamilyData::SetOptions( const std::unordered_map& options_map) { MutableCFOptions new_mutable_cf_options; - Status s = GetMutableOptionsFromStrings(mutable_cf_options_, options_map, - &new_mutable_cf_options); + Status s = + GetMutableOptionsFromStrings(mutable_cf_options_, options_map, + ioptions_.info_log, &new_mutable_cf_options); if (s.ok()) { mutable_cf_options_ = new_mutable_cf_options; mutable_cf_options_.RefreshDerivedOptions(ioptions_); diff --git a/options/options_helper.cc b/options/options_helper.cc index 6f6c8e5ed..adf99e9b4 100644 --- a/options/options_helper.cc +++ b/options/options_helper.cc @@ -704,7 +704,7 @@ bool SerializeSingleOptionHelper(const char* opt_address, Status GetMutableOptionsFromStrings( const MutableCFOptions& base_options, const std::unordered_map& options_map, - MutableCFOptions* new_options) { + Logger* info_log, MutableCFOptions* new_options) { assert(new_options); *new_options = base_options; for (const auto& o : options_map) { @@ -717,6 +717,13 @@ Status GetMutableOptionsFromStrings( if (!opt_info.is_mutable) { return Status::InvalidArgument("Option not changeable: " + o.first); } + if (opt_info.verification == OptionVerificationType::kDeprecated) { + // log warning when user tries to set a deprecated option but don't fail + // the call for compatibility. + ROCKS_LOG_WARN(info_log, "%s is a deprecated option and cannot be set", + o.first.c_str()); + continue; + } bool is_ok = ParseOptionHelper( reinterpret_cast(new_options) + opt_info.mutable_offset, opt_info.type, o.second); diff --git a/options/options_helper.h b/options/options_helper.h index 2e46877db..ab91109be 100644 --- a/options/options_helper.h +++ b/options/options_helper.h @@ -31,7 +31,7 @@ ColumnFamilyOptions BuildColumnFamilyOptions( Status GetMutableOptionsFromStrings( const MutableCFOptions& base_options, const std::unordered_map& options_map, - MutableCFOptions* new_options); + Logger* info_log, MutableCFOptions* new_options); Status GetMutableDBOptionsFromStrings( const MutableDBOptions& base_options,