]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Limit the number of lifecycle rules on one bucket. 22623/head
authorZhang Shaowen <zhangshaowen@cmss.chinamobile.com>
Tue, 19 Jun 2018 09:19:07 +0000 (17:19 +0800)
committerZhang Shaowen <zhangshaowen@cmss.chinamobile.com>
Wed, 20 Jun 2018 01:36:15 +0000 (09:36 +0800)
Fixes: http://tracker.ceph.com/issues/24572
Signed-off-by: Zhang Shaowen <zhangshaowen@cmss.chinamobile.com>
src/common/legacy_config_opts.h
src/common/options.cc
src/rgw/rgw_lc_s3.cc

index 5d2bacb12ed874435d761577127a8d8ca1f8d385..d596d0cd13a7d5d23cf8413926364e8401a315de 100644 (file)
@@ -1294,6 +1294,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 83753de44102f843c70616a0f23dbc9c7bb7bc46..b4ba17d01af55b4755478a0b4d02d4c735d75e31 100644 (file)
@@ -5070,6 +5070,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 1493d9de8f11941016a7348289a5f51347b103d9..7e7b043e92b82de68bf2f54a0aa974a034ccd42c 100644 (file)
@@ -70,6 +70,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;
 }