From 34da7182d2be9fc512d20ff66de6fdc215bd1732 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 5 Mar 2018 08:57:28 -0600 Subject: [PATCH] mon/ConfigMonitor: avoid no-op updates Do not generate a change if the proposed change does not differ from the existing config. Signed-off-by: Sage Weil --- src/mon/ConfigMonitor.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/mon/ConfigMonitor.cc b/src/mon/ConfigMonitor.cc index 0ccd523c3d82..85b45c8deb05 100644 --- a/src/mon/ConfigMonitor.cc +++ b/src/mon/ConfigMonitor.cc @@ -506,6 +506,24 @@ reply: return false; update: + // see if there is an actual change + auto p = pending.begin(); + while (p != pending.end()) { + auto q = current.find(p->first); + if (p->second && q != current.end() && *p->second == q->second) { + // set to same value + p = pending.erase(p); + } else if (!p->second && q == current.end()) { + // erasing non-existent value + p = pending.erase(p); + } else { + ++p; + } + } + if (pending.empty()) { + err = 0; + goto reply; + } force_immediate_propose(); // faster response wait_for_finished_proposal( op, -- 2.47.3