common/config: extract "changed" from md_config_impl<> to ConfigValues

for the same reason why we moved ObserverMgr out of md_config_impl<>,
"changed" cannot be shared among shards, we should move "changed" out of
md_config_impl. we can put "changed" into ConfigValues or
ConfigProxy, IMHO, it would be simpler if "changed" resides in
ConfigValues: less fragmented this way.

Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2018-07-15 19:51:46 +08:00
parent 9bfc036720
commit ca3a52938d
3 changed files with 6 additions and 10 deletions

View File

@ -1133,6 +1133,7 @@ void md_config_impl<lp>::finalize_reexpand_meta(ConfigValues& values,
// meta expands could have modified anything. Copy it all out again.
update_legacy_vals(values);
_apply_changes(values, proxy, NULL);
values.changed.clear();
}
}
@ -1445,7 +1446,7 @@ void md_config_impl<lp>::_refresh(ConfigValues& values, const Option& opt)
values.set_logging(opt.subsys, actual_val.c_str());
} else {
// normal option, advertise the change.
changed.insert(opt.name);
values.changed.insert(opt.name);
}
}

View File

@ -90,13 +90,6 @@ public:
/// true if we are a daemon (as per CephContext::code_env)
const bool is_daemon;
/* Maps configuration options to the observer listening for them. */
typedef std::multimap <std::string, md_config_obs_impl<lock_policy>*> obs_map_t;
/* Set of configuration options that have changed since the last
* apply_changes */
typedef std::set < std::string > changed_set_t;
/*
* Mapping from legacy config option names to class members
*/
@ -357,7 +350,6 @@ private:
string do_show_config_value;
obs_map_t observers;
changed_set_t changed;
vector<Option> subsys_options;

View File

@ -15,7 +15,6 @@
#include "msg/msg_types.h"
class ConfigValues {
using changed_set_t = std::set<std::string>;
using values_t = std::map<std::string, map<int32_t,Option::value_t>>;
values_t values;
// for populating md_config_impl::legacy_values in ctor
@ -28,6 +27,10 @@ public:
string cluster;
ceph::logging::SubsystemMap subsys;
bool no_mon_config = false;
// Set of configuration options that have changed since the last
// apply_changes
using changed_set_t = std::set<std::string>;
changed_set_t changed;
// This macro block defines C members of the md_config_t struct
// corresponding to the definitions in legacy_config_opts.h.