workpool = new WorkPool(this, wpw, 512);
}
-static inline bool worker_should_stop(time_t stop_at)
+static inline bool worker_should_stop(time_t stop_at, bool once)
{
- return stop_at < time(nullptr);
+ return !once && stop_at < time(nullptr);
}
int RGWLC::handle_multipart_expiration(
RGWRados::Bucket *target, const multimap<string, lc_op>& prefix_map,
- LCWorker* worker, time_t stop_at)
+ LCWorker* worker, time_t stop_at, bool once)
{
MultipartMetaFilter mp_filter;
vector<rgw_bucket_dir_entry> objs;
for (auto prefix_iter = prefix_map.begin(); prefix_iter != prefix_map.end();
++prefix_iter) {
- if (worker_should_stop(stop_at)) {
+ if (worker_should_stop(stop_at, once)) {
ldout(cct, 5) << __func__ << " interval budget EXPIRED worker "
<< worker->ix
<< dendl;
}
int RGWLC::bucket_lc_process(string& shard_id, LCWorker* worker,
- time_t stop_at)
+ time_t stop_at, bool once)
{
RGWLifecycleConfiguration config(cct);
RGWBucketInfo bucket_info;
for(auto prefix_iter = prefix_map.begin(); prefix_iter != prefix_map.end();
++prefix_iter) {
- if (worker_should_stop(stop_at)) {
+ if (worker_should_stop(stop_at, once)) {
ldout(cct, 5) << __func__ << " interval budget EXPIRED worker "
<< worker->ix
<< dendl;
worker->workpool->drain();
}
- ret = handle_multipart_expiration(&target, prefix_map, worker, stop_at);
+ ret = handle_multipart_expiration(&target, prefix_map, worker, stop_at, once);
return ret;
}
}
}
- if(!if_already_run_today(head.start_date)) {
+ if(!if_already_run_today(head.start_date) ||
+ once) {
head.start_date = now;
head.marker.clear();
ret = bucket_lc_prepare(index, worker);
<< dendl;
l.unlock(&store->getRados()->lc_pool_ctx, obj_names[index]);
- ret = bucket_lc_process(entry.bucket, worker, thread_stop_at());
+ ret = bucket_lc_process(entry.bucket, worker, thread_stop_at(), once);
bucket_lc_post(index, max_lock_secs, entry, ret, worker);
} while(1 && !once);
int list_lc_progress(const string& marker, uint32_t max_entries,
vector<cls_rgw_lc_entry>&);
int bucket_lc_prepare(int index, LCWorker* worker);
- int bucket_lc_process(string& shard_id, LCWorker* worker, time_t stop_at);
+ int bucket_lc_process(string& shard_id, LCWorker* worker, time_t stop_at,
+ bool once);
int bucket_lc_post(int index, int max_lock_sec,
cls_rgw_lc_entry& entry, int& result, LCWorker* worker);
bool going_down();
int handle_multipart_expiration(RGWRados::Bucket *target,
const multimap<string, lc_op>& prefix_map,
- LCWorker* worker,
- time_t stop_at);
+ LCWorker* worker, time_t stop_at, bool once);
};
namespace rgw::lc {