rgw: add lifecycle thread delay

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
This commit is contained in:
Matt Benjamin 2018-05-01 12:41:45 -04:00
parent 1396743746
commit 1e3f442bd6
2 changed files with 10 additions and 2 deletions

View File

@ -5028,6 +5028,10 @@ std::vector<Option> get_rgw_options() {
.set_default(60)
.set_description(""),
Option("rgw_lc_thread_delay", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(0)
.set_description("Delay after processing of bucket listing chunks (i.e., per 1000 entries) in milliseconds"),
Option("rgw_lc_max_objs", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(32)
.set_description("Number of lifecycle data shards")

View File

@ -293,6 +293,7 @@ int RGWLC::handle_multipart_expiration(RGWRados::Bucket *target, const map<strin
int ret;
RGWBucketInfo& bucket_info = target->get_bucket_info();
RGWRados::Bucket::List list_op(target);
auto delay_ms = cct->_conf->get_val<int64_t>("rgw_lc_thread_delay");
list_op.params.list_versions = false;
/* lifecycle processing does not depend on total order, so can
* take advantage of unorderd listing optimizations--such as
@ -332,7 +333,8 @@ int RGWLC::handle_multipart_expiration(RGWRados::Bucket *target, const map<strin
if (going_down())
return 0;
}
}
} /* for objs */
std::this_thread::sleep_for(std::chrono::milliseconds(delay_ms));
} while(is_truncated);
}
return 0;
@ -357,6 +359,7 @@ int RGWLC::bucket_lc_process(string& shard_id)
vector<rgw_bucket_dir_entry> objs;
RGWObjectCtx obj_ctx(store);
vector<std::string> result;
auto delay_ms = cct->_conf->get_val<int64_t>("rgw_lc_thread_delay");
boost::split(result, shard_id, boost::is_any_of(":"));
string bucket_tenant = result[0];
string bucket_name = result[1];
@ -478,7 +481,8 @@ int RGWLC::bucket_lc_process(string& shard_id)
if (going_down())
return 0;
}
}
} /* for objs */
std::this_thread::sleep_for(std::chrono::milliseconds(delay_ms));
} while (is_truncated);
}
} else {