From: xie xingguo Date: Wed, 12 Jul 2017 02:23:21 +0000 (+0800) Subject: mon/OSDMonitor: another dedup case for pg-upmap-items X-Git-Tag: ses5-milestone9~1^2~13^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=70e664b7c89619a0a4f90ba154c48920b70173b4;p=ceph.git mon/OSDMonitor: another dedup case for pg-upmap-items ./bin/ceph osd pg-upmap-items 1.0 1 2 1 2 osd.1 -> osd.2 already exists, set 1.0 pg_upmap_items mapping to [1->2] Signed-off-by: xie xingguo --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 4a613ae8843b..93194e097ac1 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -9110,7 +9110,14 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op, err = -ENOENT; goto reply; } - new_pg_upmap_items.push_back(make_pair(from, to)); + pair entry = make_pair(from, to); + auto it = std::find(new_pg_upmap_items.begin(), + new_pg_upmap_items.end(), entry); + if (it != new_pg_upmap_items.end()) { + ss << "osd." << from << " -> osd." << to << " already exists, "; + continue; + } + new_pg_upmap_items.push_back(entry); items << from << "->" << to << ","; } string out(items.str());