From b7618874dbed9e47ee97b3dcd9c5f7c778d773e5 Mon Sep 17 00:00:00 2001 From: Bingyin Zhang Date: Wed, 20 Dec 2017 15:27:05 +0800 Subject: [PATCH] rgw: format logs in file rgw_lc.cc Signed-off-by: Bingyin Zhang --- src/rgw/rgw_lc.cc | 51 ++++++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/src/rgw/rgw_lc.cc b/src/rgw/rgw_lc.cc index 33dc88d8dfd..40fe2a4f254 100644 --- a/src/rgw/rgw_lc.cc +++ b/src/rgw/rgw_lc.cc @@ -43,7 +43,7 @@ bool LCRule::valid() void RGWLifecycleConfiguration::add_rule(LCRule *rule) { string id; - rule->get_id(id); // not that this will return false for groups, but that's ok, we won't search groups + rule->get_id(id); // note that this will return false for groups, but that's ok, we won't search groups rule_map.insert(pair(id, *rule)); } @@ -145,12 +145,12 @@ void *RGWLC::LCWorker::entry() { do { utime_t start = ceph_clock_now(); if (should_work(start)) { - dout(2) << "life cycle: start" << dendl; + ldout(cct, 2) << "life cycle: start" << dendl; int r = lc->process(); if (r < 0) { - dout(0) << "ERROR: do life cycle process() returned error r=" << r << dendl; + ldout(cct, 0) << "ERROR: do life cycle process() returned error r=" << r << dendl; } - dout(2) << "life cycle: stop" << dendl; + ldout(cct, 2) << "life cycle: stop" << dendl; } if (lc->going_down()) break; @@ -160,7 +160,7 @@ void *RGWLC::LCWorker::entry() { utime_t next; next.set_from_double(end + secs); - dout(5) << "schedule life cycle next start time: " << rgw_to_asctime(next) < entry(iter->first, lc_uninitial); ret = cls_rgw_lc_set_entry(store->lc_pool_ctx, obj_names[index], entry); if (ret < 0) { - dout(0) << "RGWLC::bucket_lc_prepare() failed to set entry on " << obj_names[index] << dendl; + ldout(cct, 0) << "RGWLC::bucket_lc_prepare() failed to set entry on " + << obj_names[index] << dendl; break; } marker = iter->first; @@ -351,13 +352,13 @@ int RGWLC::bucket_lc_process(string& shard_id) 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 failed" << bucket_name <& entry do { int ret = l.lock_exclusive(&store->lc_pool_ctx, obj_names[index]); if (ret == -EBUSY) { /* already locked by another lc processor */ - dout(0) << "RGWLC::bucket_lc_post() failed to acquire lock on " << obj_names[index] << ", sleep 5, try again" << dendl; + ldout(cct, 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; - dout(20) << "RGWLC::bucket_lc_post() get lock" << obj_names[index] << dendl; + ldout(cct, 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) { - dout(0) << "RGWLC::bucket_lc_post() failed to remove entry " << obj_names[index] << dendl; + ldout(cct, 0) << "RGWLC::bucket_lc_post() failed to remove entry " + << obj_names[index] << dendl; } goto clean; } else if (result < 0) { @@ -609,11 +612,12 @@ int RGWLC::bucket_lc_post(int index, int max_lock_sec, pair& entry ret = cls_rgw_lc_set_entry(store->lc_pool_ctx, obj_names[index], entry); if (ret < 0) { - dout(0) << "RGWLC::process() failed to set entry on " << obj_names[index] << dendl; + ldout(cct, 0) << "RGWLC::process() failed to set entry on " + << obj_names[index] << dendl; } clean: l.unlock(&store->lc_pool_ctx, obj_names[index]); - dout(20) << "RGWLC::bucket_lc_post() unlock" << obj_names[index] << dendl; + ldout(cct, 20) << "RGWLC::bucket_lc_post() unlock " << obj_names[index] << dendl; return 0; } while (true); } @@ -627,7 +631,7 @@ int RGWLC::list_lc_progress(const string& marker, uint32_t max_entries, maplc_pool_ctx, obj_names[index], marker, max_entries, entries); if (ret < 0) { if (ret == -ENOENT) { - dout(10) << __func__ << "() ignoring unfound lc object=" + ldout(cct, 10) << __func__ << "() ignoring unfound lc object=" << obj_names[index] << dendl; continue; } else { @@ -672,7 +676,8 @@ int RGWLC::process(int index, int max_lock_secs) int ret = l.lock_exclusive(&store->lc_pool_ctx, obj_names[index]); if (ret == -EBUSY) { /* already locked by another lc processor */ - dout(0) << "RGWLC::process() failed to acquire lock on " << obj_names[index] << ", sleep 5, try again" << dendl; + ldout(cct, 0) << "RGWLC::process() failed to acquire lock on " + << obj_names[index] << ", sleep 5, try again" << dendl; sleep(5); continue; } @@ -683,7 +688,8 @@ int RGWLC::process(int index, int max_lock_secs) cls_rgw_lc_obj_head head; ret = cls_rgw_lc_get_head(store->lc_pool_ctx, obj_names[index], head); if (ret < 0) { - dout(0) << "RGWLC::process() failed to get obj head " << obj_names[index] << ret << dendl; + ldout(cct, 0) << "RGWLC::process() failed to get obj head " + << obj_names[index] << ", ret=" << ret << dendl; goto exit; } @@ -692,14 +698,16 @@ int RGWLC::process(int index, int max_lock_secs) head.marker.clear(); ret = bucket_lc_prepare(index); if (ret < 0) { - dout(0) << "RGWLC::process() failed to update lc object " << obj_names[index] << ret << dendl; + ldout(cct, 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) { - dout(0) << "RGWLC::process() failed to get obj entry " << obj_names[index] << dendl; + ldout(cct, 0) << "RGWLC::process() failed to get obj entry " + << obj_names[index] << dendl; goto exit; } @@ -709,14 +717,15 @@ int RGWLC::process(int index, int max_lock_secs) entry.second = lc_processing; ret = cls_rgw_lc_set_entry(store->lc_pool_ctx, obj_names[index], entry); if (ret < 0) { - dout(0) << "RGWLC::process() failed to set obj entry " << obj_names[index] << entry.first << entry.second << dendl; + ldout(cct, 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) { - dout(0) << "RGWLC::process() failed to put head " << obj_names[index] << dendl; + ldout(cct, 0) << "RGWLC::process() failed to put head " << obj_names[index] << dendl; goto exit; } l.unlock(&store->lc_pool_ctx, obj_names[index]);