]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Limit the number of lifecycle rules on one bucket. 23522/head
authorZhang Shaowen <zhangshaowen@cmss.chinamobile.com>
Tue, 19 Jun 2018 09:19:07 +0000 (17:19 +0800)
committerPrashant D <pdhange@redhat.com>
Fri, 10 Aug 2018 02:05:47 +0000 (22:05 -0400)
Fixes: http://tracker.ceph.com/issues/24572
Signed-off-by: Zhang Shaowen <zhangshaowen@cmss.chinamobile.com>
(cherry picked from commit 695eb5ae67ccb3557b6ac340b4b84b285c61b351)

src/common/legacy_config_opts.h
src/common/options.cc
src/rgw/rgw_lc_s3.cc

index 69bfcd7dee369501397f0d0c408068ab0b1040b5..4cafd8dcc10dabb309557e9a92eda1ae425c202e 100644 (file)
@@ -1342,6 +1342,7 @@ OPTION(rgw_content_length_compat, OPT_BOOL) // Check both HTTP_CONTENT_LENGTH an
 OPTION(rgw_lifecycle_work_time, OPT_STR) //job process lc  at 00:00-06:00s
 OPTION(rgw_lc_lock_max_time, OPT_INT)  // total run time for a single lc processor work
 OPTION(rgw_lc_max_objs, OPT_INT)
+OPTION(rgw_lc_max_rules, OPT_U32)  // Max rules set on one bucket
 OPTION(rgw_lc_debug_interval, OPT_INT)  // Debug run interval, in seconds
 OPTION(rgw_script_uri, OPT_STR) // alternative value for SCRIPT_URI if not set in request
 OPTION(rgw_request_uri, OPT_STR) // alternative value for REQUEST_URI if not set in request
index 5d1f1fb9e3339515bf3a087b37cc4d1eae71c168..bd7c02de71d72e0d204e372da1ff821233b28f98 100644 (file)
@@ -4534,6 +4534,11 @@ std::vector<Option> get_rgw_options() {
           "concurrency of lifecycle maintenance, but requires multiple RGW processes "
           "running on the zone to be utilized."),
 
+    Option("rgw_lc_max_rules", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
+    .set_default(1000)
+    .set_description("Max number of lifecycle rules set on one bucket")
+    .set_long_description("Number of lifecycle rules set on one bucket should be limited."),
+
     Option("rgw_lc_debug_interval", Option::TYPE_INT, Option::LEVEL_DEV)
     .set_default(-1)
     .set_description(""),
index 7fa3b8e1a05eed8c6038c14f70701deac9f70900..3b783c5b5f96b93fd74303bf5934766452e6ad8e 100644 (file)
@@ -66,6 +66,11 @@ bool RGWLifecycleConfiguration_S3::xml_end(const char *el) {
     add_rule(rule);
     rule = static_cast<LCRule_S3 *>(iter.get_next());
   }
+  if (cct->_conf->rgw_lc_max_rules < rule_map.size()) {
+    ldout(cct, 5) << "Warn: The lifecycle config has too many rules, rule number is:" 
+                  << rule_map.size() << ", max number is:" << cct->_conf->rgw_lc_max_rules << dendl;
+    return false;
+  }
   return true;
 }