diff options
author | Sage Weil <sage@redhat.com> | 2018-02-02 18:29:21 +0100 |
---|---|---|
committer | Sage Weil <sage@redhat.com> | 2018-03-06 21:44:50 +0100 |
commit | 8e2a30068accd74c4bb452852375e7e94e00c50b (patch) | |
tree | 3bf8aca6739d1d2a7bce3da5a749195c086209f3 | |
parent | vstart.sh: fix osd bootstrap (diff) | |
download | ceph-8e2a30068accd74c4bb452852375e7e94e00c50b.tar.xz ceph-8e2a30068accd74c4bb452852375e7e94e00c50b.zip |
mgr/MgrClient: only send config_bl if it has changed
The mgr already treats the config_bl as optional in the MMgrReport
messages.
Signed-off-by: Sage Weil <sage@redhat.com>
-rw-r--r-- | src/common/config.cc | 11 | ||||
-rw-r--r-- | src/common/config.h | 7 | ||||
-rw-r--r-- | src/mgr/MgrClient.cc | 5 | ||||
-rw-r--r-- | src/mgr/MgrClient.h | 2 |
4 files changed, 20 insertions, 5 deletions
diff --git a/src/common/config.cc b/src/common/config.cc index 0bb9ae37c64..b1b5861e36d 100644 --- a/src/common/config.cc +++ b/src/common/config.cc @@ -916,7 +916,10 @@ void md_config_t::get_defaults_bl(bufferlist *bl) *bl = defaults_bl; } -void md_config_t::get_config_bl(bufferlist *bl) +void md_config_t::get_config_bl( + uint64_t have_version, + bufferlist *bl, + uint64_t *got_version) { Mutex::Locker l(lock); if (values_bl.length() == 0) { @@ -959,8 +962,12 @@ void md_config_t::get_config_bl(bufferlist *bl) encode(n, values_bl); values_bl.claim_append(bl); encode(ignored_mon_values, values_bl); + ++values_bl_version; + } + if (have_version != values_bl_version) { + *bl = values_bl; + *got_version = values_bl_version; } - *bl = values_bl; } int md_config_t::get_val(const std::string &key, char **buf, int len) const diff --git a/src/common/config.h b/src/common/config.h index 390efa1ae58..01db98cbaef 100644 --- a/src/common/config.h +++ b/src/common/config.h @@ -110,6 +110,9 @@ public: /// encoded, cached copy of of values + ignored_mon_values bufferlist values_bl; + /// version for values_bl; increments each time there is a change + uint64_t values_bl_version = 0; + /// encoded copy of defaults (map<string,string>) bufferlist defaults_bl; @@ -190,7 +193,9 @@ public: int rm_val(const std::string& key); /// get encoded map<string,map<int32_t,string>> of entire config - void get_config_bl(bufferlist *bl); + void get_config_bl(uint64_t have_version, + bufferlist *bl, + uint64_t *got_version); /// get encoded map<string,string> of compiled-in defaults void get_defaults_bl(bufferlist *bl); diff --git a/src/mgr/MgrClient.cc b/src/mgr/MgrClient.cc index 7f50258b771..25b0eea2cc8 100644 --- a/src/mgr/MgrClient.cc +++ b/src/mgr/MgrClient.cc @@ -174,7 +174,7 @@ void MgrClient::_send_open() open->service_daemon = service_daemon; open->daemon_metadata = daemon_metadata; } - cct->_conf->get_config_bl(&open->config_bl); + cct->_conf->get_config_bl(0, &open->config_bl, &last_config_bl_version); cct->_conf->get_defaults_bl(&open->config_defaults_bl); session->con->send_message(open); } @@ -331,7 +331,8 @@ void MgrClient::send_report() report->osd_health_metrics = std::move(osd_health_metrics); - cct->_conf->get_config_bl(&report->config_bl); + cct->_conf->get_config_bl(last_config_bl_version, &report->config_bl, + &last_config_bl_version); session->con->send_message(report); } diff --git a/src/mgr/MgrClient.h b/src/mgr/MgrClient.h index a3493f5c664..0f4d3c32e69 100644 --- a/src/mgr/MgrClient.h +++ b/src/mgr/MgrClient.h @@ -66,6 +66,8 @@ protected: utime_t last_connect_attempt; + uint64_t last_config_bl_version = 0; + Context *report_callback = nullptr; Context *connect_retry_callback = nullptr; |