common: modify md_config_obs_impl API#61394
Conversation
10ee3d4 to
bf27274
Compare
bf27274 to
e2ea8ad
Compare
| class md_config_cacher_t : public md_config_obs_t { | ||
| ConfigProxy& conf; | ||
| const char* keys[2]; | ||
| const std::string option_name; |
There was a problem hiding this comment.
Yeah, this is so cold part of the code that employing std::string seems purely beneficial.
src/common/config_obs.h
Outdated
| * a leaner version of get_tracked_conf_keys() that returns a single key. | ||
| * If returns a valid string - get_tracked_conf_keys() will not be called. | ||
| */ | ||
| virtual std::optional<std::string> get_tracked_conf_key() const noexcept { |
There was a problem hiding this comment.
Is there a plan to deprecate / drop the old get_tracked_conf_keys()?
How much of work this would need?
There was a problem hiding this comment.
Not really, as most of the users register multiple keys.
I do want to change the signatures to 'const char * const *' - to better handle const strings as arguments.
But it might be a good idea to modify the multi-key interface altogether - to use strings and be copied directly into the strings of the config manager.
There was a problem hiding this comment.
But that's for the next PR...
There was a problem hiding this comment.
I'm not really seeing a big benefit for this PR while it complicates the interface. It's not like we have a ton of config obs which only care about one option name?
I do agree something like std::array<std::string> const& would be preferable as a return type.
There was a problem hiding this comment.
we have a ton of config obs which only care about one option name?
Yes - we will have (in the OSD), as we plan to move more 'change aware' configs to be wrapped in the single-key md_config_cacher_t (currently we have 11 of those, but that's just the beginning). The reason for this direction is that we've learned that the get<> interface for the configs is very slow.
std::arraystd::string const&
(I do not think we can use std::array, but std::vector is a valid choice).
I did not want to have to change all clients of the existing interface in this PR, and preferred to make that the next step. Not sure about the 'const&', though. I will have to play with that. If possible, I'd wish the actual texts to be moved-to during registration.
There was a problem hiding this comment.
I have modified the PR, discarding the one-key API. See comment below.
|
@batrick - can you take a look? appreciate your input. Thanks. |
src/common/config_obs.h
Outdated
| * a leaner version of get_tracked_conf_keys() that returns a single key. | ||
| * If returns a valid string - get_tracked_conf_keys() will not be called. | ||
| */ | ||
| virtual std::optional<std::string> get_tracked_conf_key() const noexcept { |
There was a problem hiding this comment.
I'm not really seeing a big benefit for this PR while it complicates the interface. It's not like we have a ton of config obs which only care about one option name?
I do agree something like std::array<std::string> const& would be preferable as a return type.
Adding a new version of the API used by the configuration manager to find out what keys are handled by the specific observer (and thus should be registered to be updated on changes). The new interface (get_tracked_keys()) returns a vector of moveable strings. Modify the ObserverMgr to use this new interface when avaiable. The existing 'char**' based interface is maintained for now, until all its clients are updated. Signed-off-by: Ronen Friedman <[email protected]>
Modify the md_config_cacher_t to implement the new get_tracked_keys() callback, instead of the deprecated char* based get_tracked_conf_keys(). Signed-off-by: Ronen Friedman <[email protected]>
e2ea8ad to
daa164c
Compare
|
Following the review comments, I have modified the PR as follows: The Observer now has one new registration function: this new one would be used for all registrations - including 'single key' ones. The old Note: the new interface returns a vector of strings that are moved |
src/common/ceph_context.cc
Outdated
| static const char *KEYS[] = {"lockdep", NULL}; | ||
| return KEYS; | ||
| std::vector<std::string> get_tracked_keys() const noexcept override { | ||
| return std::vector<std::string>{"lockdep"s}; |
There was a problem hiding this comment.
nit: not sure we really need to repeat the type; perhaps return {"lockdep"s}; would be enough.
There was a problem hiding this comment.
You are right. Fixed.
modify some configuration object registrations in common/ceph_context to use the updated md_config_obs_t::get_tracked_keys() API Signed-off-by: Ronen Friedman <[email protected]>
daa164c to
7c8f081
Compare
Dismissing, as code changed per request, and re-reviewed by Radek
|
jenkins test make check |
|
Merging based on my Teuthology tests, both as part of wip-rf-combined-30j, and as a separate branch. |
.. with get_tracked_keys(). This PR is but one of a set. Following ceph#61394, all uses of the deprecated interface will be updated, and that old interface will be removed. Signed-off-by: Ronen Friedman <[email protected]>
.. with get_tracked_keys(). This PR is but one of a set. Following ceph/ceph#61394, all uses of the deprecated interface will be updated, and that old interface will be removed. Signed-off-by: Ronen Friedman <[email protected]> (cherry picked from commit f9e30c8)
.. with get_tracked_keys(). Following ceph#61394, all uses of the deprecated interface will be updated, and that old interface will be removed. Signed-off-by: Ronen Friedman <[email protected]>
.. with get_tracked_keys(). Following ceph#61394, all uses of the deprecated interface will be updated, and that old interface will be removed. Signed-off-by: Ronen Friedman <[email protected]>
.. with get_tracked_keys(). Following ceph#61394, all uses of the deprecated interface will be updated, and that old interface will be removed. Signed-off-by: Ronen Friedman <[email protected]>
.. with get_tracked_keys(). Following ceph#61394, all uses of the deprecated interface will be updated, and that old interface will be removed. Signed-off-by: Ronen Friedman <[email protected]>
.. with get_tracked_keys(). Following ceph#61394, all uses of the deprecated interface will be updated, and that old interface will be removed. Signed-off-by: Ronen Friedman <[email protected]>
.. with get_tracked_keys(). Following ceph#61394, all uses of the deprecated interface will be updated, and that old interface will be removed. Signed-off-by: Ronen Friedman <[email protected]>
.. with get_tracked_keys(). Following ceph#61394, all uses of the deprecated interface will be updated, and that old interface will be removed. Signed-off-by: Ronen Friedman <[email protected]>
.. with get_tracked_keys(). Following ceph#61394, all uses of the deprecated interface will be updated, and that old interface will be removed. Signed-off-by: Ronen Friedman <[email protected]>
.. with get_tracked_keys(). Following ceph#61394, all uses of the deprecated interface will be updated, and that old interface will be removed. Signed-off-by: Ronen Friedman <[email protected]>
.. with get_tracked_keys(). Following ceph#61394, all uses of the deprecated interface will be updated, and that old interface will be removed. Signed-off-by: Ronen Friedman <[email protected]>
.. with get_tracked_keys(). Following ceph#61394, all uses of the deprecated interface will be updated, and that old interface will be removed. Signed-off-by: Ronen Friedman <[email protected]>
.. with get_tracked_keys(). Following ceph#61394, all uses of the deprecated interface will be updated, and that old interface will be removed. Signed-off-by: Ronen Friedman <[email protected]>
.. with get_tracked_keys(). Following ceph#61394, all uses of the deprecated interface will be updated, and that old interface will be removed. Signed-off-by: Ronen Friedman <[email protected]>
.. with get_tracked_keys(). As per the original code in this specific case: the vector of keys is expected to be sorted. Following ceph#61394, all uses of the deprecated interface will be updated, and that old interface will be removed. Signed-off-by: Ronen Friedman <[email protected]>
.. with get_tracked_keys(). Following ceph#61394, all uses of the deprecated interface will be updated, and that old interface will be removed. Signed-off-by: Ronen Friedman <[email protected]>
.. with get_tracked_keys(). As per the original code in this specific case: the vector of keys is expected to be sorted. Following ceph#61394, all uses of the deprecated interface will be updated, and that old interface will be removed. Signed-off-by: Ronen Friedman <[email protected]>
.. with get_tracked_keys(). Following ceph#61394, all uses of the deprecated interface will be updated, and that old interface will be removed. Signed-off-by: Ronen Friedman <[email protected]>
.. with get_tracked_keys(). Following ceph#61394, all uses of the deprecated interface will be updated, and that old interface will be removed. Signed-off-by: Ronen Friedman <[email protected]>
.. with get_tracked_keys(). Following ceph#61394, all uses of the deprecated interface will be updated, and that old interface will be removed. Signed-off-by: Ronen Friedman <[email protected]>
.. with get_tracked_keys(). As per the original code in this specific case: the vector of keys is expected to be sorted. Following ceph#61394, all uses of the deprecated interface will be updated, and that old interface will be removed. Signed-off-by: Ronen Friedman <[email protected]>
.. with get_tracked_keys(). Following ceph#61394, all uses of the deprecated interface will be updated, and that old interface will be removed. Signed-off-by: Ronen Friedman <[email protected]>
.. with get_tracked_keys(). Following ceph#61394, all uses of the deprecated interface will be updated, and that old interface will be removed. Signed-off-by: Ronen Friedman <[email protected]>
.. with get_tracked_keys(). Following ceph#61394, all uses of the deprecated interface will be updated, and that old interface will be removed. Signed-off-by: Ronen Friedman <[email protected]>
.. with get_tracked_keys(). Following ceph#61394, all uses of the deprecated interface will be updated, and that old interface will be removed. Signed-off-by: Ronen Friedman <[email protected]>
.. with get_tracked_keys(). This PR is but one of a set. Following ceph/ceph#61394, all uses of the deprecated interface will be updated, and that old interface will be removed. Signed-off-by: Ronen Friedman <[email protected]>
Modify the md_config_cacher_t to implement the new get_tracked_conf_key() API.
Apart from resulting in a clearer code, this also solves the potential for a dangling
pointer issue that was present in the existing code.
This is a continuation of #61289. That PR was
enough to solve existing config-cacher bugs, and was created with backporting
in mind - but it was just one step on the road of improving the cacher. The current
PR is the next step.