}
class RGWGCIOManager {
+ const DoutPrefixProvider* dpp;
CephContext *cct;
RGWGC *gc;
size_t max_aio{MAX_AIO_DEFAULT};
public:
- RGWGCIOManager(CephContext *_cct, RGWGC *_gc) : cct(_cct),
+ RGWGCIOManager(const DoutPrefixProvider* _dpp, CephContext *_cct, RGWGC *_gc) : dpp(_dpp),
+ cct(_cct),
gc(_gc),
remove_tags(cct->_conf->rgw_gc_max_objs) {
max_aio = cct->_conf->rgw_gc_max_concurrent_io;
if (io.type == IO::IndexIO) {
if (ret < 0) {
- ldout(cct, 0) << "WARNING: gc cleanup of tags on gc shard index=" << io.index << " returned error, ret=" << ret << dendl;
+ ldpp_dout(dpp, 0) << "WARNING: gc cleanup of tags on gc shard index=" << io.index << " returned error, ret=" << ret << dendl;
}
goto done;
}
if (ret < 0) {
- ldout(cct, 0) << "WARNING: could not remove oid=" << io.oid << ", ret=" << ret << dendl;
+ ldpp_dout(dpp, 0) << "WARNING: could not remove oid=" << io.oid << ", ret=" << ret << dendl;
goto done;
}
/* we already cleared list of tags, this prevents us from ballooning in case of
* a persistent problem
*/
- ldout(cct, 0) << "WARNING: failed to remove tags on gc shard index=" << index << " ret=" << ret << dendl;
+ ldpp_dout(dpp, 0) << "WARNING: failed to remove tags on gc shard index=" << index << " ret=" << ret << dendl;
return;
}
ios.push_back(index_io);
int ret = l.lock_exclusive(&store->gc_pool_ctx, obj_names[index]);
if (ret == -EBUSY) { /* already locked by another gc processor */
- dout(10) << "RGWGC::process() failed to acquire lock on " << obj_names[index] << dendl;
+ ldpp_dout(this, 10) << "RGWGC::process() failed to acquire lock on " << obj_names[index] << dendl;
return 0;
}
if (ret < 0)
ctx = new IoCtx;
ret = rgw_init_ioctx(store->get_rados_handle(), obj.pool, *ctx);
if (ret < 0) {
- dout(0) << "ERROR: failed to create ioctx pool=" << obj.pool << dendl;
+ ldpp_dout(this, 0) << "ERROR: failed to create ioctx pool=" << obj.pool << dendl;
continue;
}
last_pool = obj.pool;
const string& oid = obj.key.name; /* just stored raw oid there */
- dout(5) << "gc::process: removing " << obj.pool << ":" << obj.key.name << dendl;
+ ldpp_dout(this, 5) << "gc::process: removing " << obj.pool << ":" << obj.key.name << dendl;
ObjectWriteOperation op;
cls_refcount_put(op, info.tag, true);
ret = io_manager.schedule_io(ctx, oid, &op, index, info.tag);
if (ret < 0) {
- ldout(store->ctx(), 0) << "WARNING: failed to schedule deletion for oid=" << oid << dendl;
+ ldpp_dout(this, 0) << "WARNING: failed to schedule deletion for oid=" << oid << dendl;
}
if (going_down()) // leave early, even if tag isn't removed, it's ok
const int start = ceph::util::generate_random_number(0, max_objs - 1);
- RGWGCIOManager io_manager(store->ctx(), this);
+ RGWGCIOManager io_manager(this, store->ctx(), this);
for (int i = 0; i < max_objs; i++) {
int index = (i + start) % max_objs;
void RGWGC::start_processor()
{
- worker = new GCWorker(cct, this);
+ worker = new GCWorker(this, cct, this);
worker->create("rgw_gc");
}
worker = NULL;
}
+unsigned RGWGC::get_subsys() const
+{
+ return dout_subsys;
+}
+
+std::ostream& RGWGC::gen_prefix(std::ostream& out) const
+{
+ return out << "garbage collection: ";
+}
+
void *RGWGC::GCWorker::entry() {
do {
utime_t start = ceph_clock_now();
- dout(2) << "garbage collection: start" << dendl;
+ ldpp_dout(dpp, 2) << "garbage collection: start" << dendl;
int r = gc->process(true);
if (r < 0) {
- dout(0) << "ERROR: garbage collection process() returned error r=" << r << dendl;
+ ldpp_dout(dpp, 0) << "ERROR: garbage collection process() returned error r=" << r << dendl;
}
- dout(2) << "garbage collection: stop" << dendl;
+ ldpp_dout(dpp, 2) << "garbage collection: stop" << dendl;
if (gc->going_down())
break;
do {
utime_t start = ceph_clock_now();
if (should_work(start)) {
- ldout(cct, 2) << "life cycle: start" << dendl;
+ ldpp_dout(dpp, 2) << "life cycle: start" << dendl;
int r = lc->process();
if (r < 0) {
- ldout(cct, 0) << "ERROR: do life cycle process() returned error r=" << r << dendl;
+ ldpp_dout(dpp, 0) << "ERROR: do life cycle process() returned error r=" << r << dendl;
}
- ldout(cct, 2) << "life cycle: stop" << dendl;
+ ldpp_dout(dpp, 2) << "life cycle: stop" << dendl;
}
if (lc->going_down())
break;
utime_t next;
next.set_from_double(end + secs);
- ldout(cct, 5) << "schedule life cycle next start time: " << rgw_to_asctime(next) << dendl;
+ ldpp_dout(dpp, 5) << "schedule life cycle next start time: " << rgw_to_asctime(next) << dendl;
lock.Lock();
cond.WaitInterval(lock, utime_t(secs, 0));
pair<string, int > entry(iter->first, lc_uninitial);
ret = cls_rgw_lc_set_entry(store->lc_pool_ctx, obj_names[index], entry);
if (ret < 0) {
- ldout(cct, 0) << "RGWLC::bucket_lc_prepare() failed to set entry on "
+ ldpp_dout(this, 0) << "RGWLC::bucket_lc_prepare() failed to set entry on "
<< obj_names[index] << dendl;
return ret;
}
if (ret < 0) {
if (ret == (-ENOENT))
return 0;
- ldout(cct, 0) << "ERROR: store->list_objects():" <<dendl;
+ ldpp_dout(this, 0) << "ERROR: store->list_objects():" <<dendl;
return ret;
}
RGWObjectCtx rctx(store);
ret = abort_multipart_upload(store, cct, &rctx, bucket_info, mp_obj);
if (ret < 0 && ret != -ERR_NO_SUCH_UPLOAD) {
- ldout(cct, 0) << "ERROR: abort_multipart_upload failed, ret=" << ret << ", meta:" << obj_iter->key << dendl;
+ ldpp_dout(this, 0) << "ERROR: abort_multipart_upload failed, ret=" << ret << ", meta:" << obj_iter->key << dendl;
} else if (ret == -ERR_NO_SUCH_UPLOAD) {
- ldout(cct, 5) << "ERROR: abort_multipart_upload failed, ret=" << ret << ", meta:" << obj_iter->key << dendl;
+ ldpp_dout(this, 5) << "ERROR: abort_multipart_upload failed, ret=" << ret << ", meta:" << obj_iter->key << dendl;
}
if (going_down())
return 0;
string bucket_id = result[2];
int ret = store->get_bucket_info(obj_ctx, bucket_tenant, bucket_name, bucket_info, NULL, &bucket_attrs);
if (ret < 0) {
- ldout(cct, 0) << "LC:get_bucket_info for " << bucket_name << " failed" << dendl;
+ ldpp_dout(this, 0) << "LC:get_bucket_info for " << bucket_name << " failed" << dendl;
return ret;
}
ret = bucket_info.bucket.bucket_id.compare(bucket_id) ;
if (ret != 0) {
- ldout(cct, 0) << "LC:old bucket id found. " << bucket_name << " should be deleted" << dendl;
+ ldpp_dout(this, 0) << "LC:old bucket id found. " << bucket_name << " should be deleted" << dendl;
return -ENOENT;
}
try {
config.decode(iter);
} catch (const buffer::error& e) {
- ldout(cct, 0) << __func__ << "() decode life cycle config failed" << dendl;
+ ldpp_dout(this, 0) << __func__ << "() decode life cycle config failed" << dendl;
return -1;
}
if (ret < 0) {
if (ret == (-ENOENT))
return 0;
- ldout(cct, 0) << "ERROR: store->list_objects():" <<dendl;
+ ldpp_dout(this, 0) << "ERROR: store->list_objects():" <<dendl;
return ret;
}
int ret = read_obj_tags(store, bucket_info, obj, rctx, tags_bl);
if (ret < 0) {
if (ret != -ENODATA)
- ldout(cct, 5) << "ERROR: read_obj_tags returned r=" << ret << dendl;
+ ldpp_dout(this, 5) << "ERROR: read_obj_tags returned r=" << ret << dendl;
continue;
}
RGWObjTags dest_obj_tags;
auto iter = tags_bl.cbegin();
dest_obj_tags.decode(iter);
} catch (buffer::error& err) {
- ldout(cct,0) << "ERROR: caught buffer::error, couldn't decode TagSet" << dendl;
+ ldpp_dout(this,0) << "ERROR: caught buffer::error, couldn't decode TagSet" << dendl;
return -EIO;
}
dest_obj_tags.get_tags().end(),
prefix_iter->second.obj_tags->get_tags().begin(),
prefix_iter->second.obj_tags->get_tags().end())){
- ldout(cct, 20) << __func__ << "() skipping obj " << key << " as tags do not match" << dendl;
+ ldpp_dout(this, 20) << __func__ << "() skipping obj " << key << " as tags do not match" << dendl;
continue;
}
}
}
if (state->mtime != obj_iter->meta.mtime) {
//Check mtime again to avoid delete a recently update object as much as possible
- ldout(cct, 20) << __func__ << "() skipping removal: state->mtime " << state->mtime << " obj->mtime " << obj_iter->meta.mtime << dendl;
+ ldpp_dout(this, 20) << __func__ << "() skipping removal: state->mtime " << state->mtime << " obj->mtime " << obj_iter->meta.mtime << dendl;
continue;
}
ret = remove_expired_obj(bucket_info, obj_iter->key, obj_iter->meta.owner, obj_iter->meta.owner_display_name, true);
if (ret < 0) {
- ldout(cct, 0) << "ERROR: remove_expired_obj " << dendl;
+ ldpp_dout(this, 0) << "ERROR: remove_expired_obj " << dendl;
} else {
- ldout(cct, 2) << "DELETED:" << bucket_name << ":" << key << dendl;
+ ldpp_dout(this, 2) << "DELETED:" << bucket_name << ":" << key << dendl;
}
if (going_down())
if (ret < 0) {
if (ret == (-ENOENT))
return 0;
- ldout(cct, 0) << "ERROR: store->list_objects():" <<dendl;
+ ldpp_dout(this, 0) << "ERROR: store->list_objects():" <<dendl;
return ret;
}
}
ret = remove_expired_obj(bucket_info, obj_iter->key, obj_iter->meta.owner, obj_iter->meta.owner_display_name, remove_indeed);
if (ret < 0) {
- ldout(cct, 0) << "ERROR: remove_expired_obj " << dendl;
+ ldpp_dout(this, 0) << "ERROR: remove_expired_obj " << dendl;
} else {
- ldout(cct, 2) << "DELETED:" << bucket_name << ":" << obj_iter->key << dendl;
+ ldpp_dout(this, 2) << "DELETED:" << bucket_name << ":" << obj_iter->key << dendl;
}
if (going_down())
do {
int ret = l.lock_exclusive(&store->lc_pool_ctx, obj_names[index]);
if (ret == -EBUSY) { /* already locked by another lc processor */
- ldout(cct, 0) << "RGWLC::bucket_lc_post() failed to acquire lock on "
+ ldpp_dout(this, 0) << "RGWLC::bucket_lc_post() failed to acquire lock on "
<< obj_names[index] << ", sleep 5, try again" << dendl;
sleep(5);
continue;
}
if (ret < 0)
return 0;
- ldout(cct, 20) << "RGWLC::bucket_lc_post() lock " << obj_names[index] << dendl;
+ ldpp_dout(this, 20) << "RGWLC::bucket_lc_post() lock " << obj_names[index] << dendl;
if (result == -ENOENT) {
ret = cls_rgw_lc_rm_entry(store->lc_pool_ctx, obj_names[index], entry);
if (ret < 0) {
- ldout(cct, 0) << "RGWLC::bucket_lc_post() failed to remove entry "
+ ldpp_dout(this, 0) << "RGWLC::bucket_lc_post() failed to remove entry "
<< obj_names[index] << dendl;
}
goto clean;
ret = cls_rgw_lc_set_entry(store->lc_pool_ctx, obj_names[index], entry);
if (ret < 0) {
- ldout(cct, 0) << "RGWLC::process() failed to set entry on "
+ ldpp_dout(this, 0) << "RGWLC::process() failed to set entry on "
<< obj_names[index] << dendl;
}
clean:
l.unlock(&store->lc_pool_ctx, obj_names[index]);
- ldout(cct, 20) << "RGWLC::bucket_lc_post() unlock " << obj_names[index] << dendl;
+ ldpp_dout(this, 20) << "RGWLC::bucket_lc_post() unlock " << obj_names[index] << dendl;
return 0;
} while (true);
}
int ret = cls_rgw_lc_list(store->lc_pool_ctx, obj_names[index], marker, max_entries, entries);
if (ret < 0) {
if (ret == -ENOENT) {
- ldout(cct, 10) << __func__ << "() ignoring unfound lc object="
+ ldpp_dout(this, 10) << __func__ << "() ignoring unfound lc object="
<< obj_names[index] << dendl;
continue;
} else {
int ret = l.lock_exclusive(&store->lc_pool_ctx, obj_names[index]);
if (ret == -EBUSY) { /* already locked by another lc processor */
- ldout(cct, 0) << "RGWLC::process() failed to acquire lock on "
+ ldpp_dout(this, 0) << "RGWLC::process() failed to acquire lock on "
<< obj_names[index] << ", sleep 5, try again" << dendl;
sleep(5);
continue;
cls_rgw_lc_obj_head head;
ret = cls_rgw_lc_get_head(store->lc_pool_ctx, obj_names[index], head);
if (ret < 0) {
- ldout(cct, 0) << "RGWLC::process() failed to get obj head "
+ ldpp_dout(this, 0) << "RGWLC::process() failed to get obj head "
<< obj_names[index] << ", ret=" << ret << dendl;
goto exit;
}
head.marker.clear();
ret = bucket_lc_prepare(index);
if (ret < 0) {
- ldout(cct, 0) << "RGWLC::process() failed to update lc object "
+ ldpp_dout(this, 0) << "RGWLC::process() failed to update lc object "
<< obj_names[index] << ", ret=" << ret << dendl;
goto exit;
}
ret = cls_rgw_lc_get_next_entry(store->lc_pool_ctx, obj_names[index], head.marker, entry);
if (ret < 0) {
- ldout(cct, 0) << "RGWLC::process() failed to get obj entry "
+ ldpp_dout(this, 0) << "RGWLC::process() failed to get obj entry "
<< obj_names[index] << dendl;
goto exit;
}
entry.second = lc_processing;
ret = cls_rgw_lc_set_entry(store->lc_pool_ctx, obj_names[index], entry);
if (ret < 0) {
- ldout(cct, 0) << "RGWLC::process() failed to set obj entry " << obj_names[index]
+ ldpp_dout(this, 0) << "RGWLC::process() failed to set obj entry " << obj_names[index]
<< " (" << entry.first << "," << entry.second << ")" << dendl;
goto exit;
}
head.marker = entry.first;
ret = cls_rgw_lc_put_head(store->lc_pool_ctx, obj_names[index], head);
if (ret < 0) {
- ldout(cct, 0) << "RGWLC::process() failed to put head " << obj_names[index] << dendl;
+ ldpp_dout(this, 0) << "RGWLC::process() failed to put head " << obj_names[index] << dendl;
goto exit;
}
l.unlock(&store->lc_pool_ctx, obj_names[index]);
void RGWLC::start_processor()
{
- worker = new LCWorker(cct, this);
+ worker = new LCWorker(this, cct, this);
worker->create("lifecycle_thr");
}
worker = NULL;
}
+
+unsigned RGWLC::get_subsys() const
+{
+ return dout_subsys;
+}
+
+std::ostream& RGWLC::gen_prefix(std::ostream& out) const
+{
+ return out << "lifecycle: ";
+}
+
void RGWLC::LCWorker::stop()
{
Mutex::Locker l(lock);