From: Matt Benjamin Date: Mon, 25 Feb 2019 20:36:07 +0000 (-0500) Subject: rgw: lifecycle: fix RGWLifecycleConfiguration::valid() X-Git-Tag: v14.2.3~129^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e1c4726657f186cd8a8916bc4eb4b5c601e87c24;p=ceph.git rgw: lifecycle: fix RGWLifecycleConfiguration::valid() Signed-off-by: Matt Benjamin (cherry picked from commit c8ae682b669acdc1937e62d43b266e58a313a374) --- diff --git a/src/rgw/rgw_lc.cc b/src/rgw/rgw_lc.cc index b3c9746b3410..bae5119c93ff 100644 --- a/src/rgw/rgw_lc.cc +++ b/src/rgw/rgw_lc.cc @@ -172,32 +172,10 @@ bool RGWLifecycleConfiguration::has_same_action(const lc_op& first, const lc_op& return false; } -//Rules are conflicted: if one rule's prefix starts with other rule's prefix, and these two rules -//define same action. +/* Formerly, this method checked for duplicate rules using an invalid + * method (prefix uniqueness). */ bool RGWLifecycleConfiguration::valid() { - if (prefix_map.size() < 2) { - return true; - } - auto cur_iter = prefix_map.begin(); - while (cur_iter != prefix_map.end()) { - auto next_iter = cur_iter; - ++next_iter; - while (next_iter != prefix_map.end()) { - string c_pre = cur_iter->first; - string n_pre = next_iter->first; - if (n_pre.compare(0, c_pre.length(), c_pre) == 0) { - if (has_same_action(cur_iter->second, next_iter->second)) { - return false; - } else { - ++next_iter; - } - } else { - break; - } - } - ++cur_iter; - } return true; }