]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/config: extract "changed" from md_config_impl<> to ConfigValues
authorKefu Chai <kchai@redhat.com>
Sun, 15 Jul 2018 11:51:46 +0000 (19:51 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 24 Jul 2018 02:17:48 +0000 (10:17 +0800)
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>
src/common/config.cc
src/common/config.h
src/common/config_values.h

index 4cb5c8d5fb319d9026c5034245345bafbd43c9b5..fb151dbbb96d58817954185f09dfebbf3012e3d7 100644 (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);
   }
 }
 
index 747f0985957f94a4e541e522778bf8dc07483873..d3f54e83838e7bebc1b5a871348a1de66436cd8d 100644 (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;
 
index bbd4d3224be260703a345b32d7db798c5048348b..d364fa1bbcd63c95042e06670d5a179409390125 100644 (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.