]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgwlc: add lifecycle perf counters
authorMatt Benjamin <mbenjamin@redhat.com>
Fri, 22 May 2020 21:43:46 +0000 (17:43 -0400)
committerNathan Cutler <ncutler@suse.com>
Sun, 9 Aug 2020 20:49:12 +0000 (22:49 +0200)
Historically, RGW lifecycle processing has not provided perfcounters.
A single expire counter was added in recent parallel lifecycle changes,
but granular counters for

    current expiration
    non-current expiration
    delete-marker expiration
    current transition
    non-current transition
    mpu aborts

are arguably much more useful, and can be summed in reports.

Fixes: https://tracker.ceph.com/issues/45667
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
(cherry picked from commit 57d0bcf57d7d5774b63465ae46dafd0253afde04)

src/rgw/rgw_lc.cc
src/rgw/rgw_lc.h
src/rgw/rgw_perf_counters.cc
src/rgw/rgw_perf_counters.h

index 46e17d12f89b68cfb767832034e496b831fb1133..d3091388608a01a9cc8244fb09466102e0023830 100644 (file)
@@ -585,10 +585,6 @@ static int remove_expired_obj(lc_op_ctx& oc, bool remove_indeed)
   del_op.params.obj_owner = obj_owner;
   del_op.params.unmod_since = meta.mtime;
 
-  if (perfcounter) {
-    perfcounter->inc(l_rgw_lc_remove_expired, 1);
-  }
-
   return del_op.delete_obj(null_yield);
 } /* remove_expired_obj */
 
@@ -842,20 +838,26 @@ int RGWLC::handle_multipart_expiration(
        return;
       }
       RGWObjectCtx rctx(store);
-      ret = abort_multipart_upload(store, cct, &rctx, bucket_info, mp_obj);
-      if (ret < 0 && ret != -ERR_NO_SUCH_UPLOAD) {
-       ldpp_dout(wk->get_lc(), 0)
-         << "ERROR: abort_multipart_upload failed, ret=" << ret
-         << wq->thr_name()
-         << ", meta:" << obj.key
-         << dendl;
-      } else if (ret == -ERR_NO_SUCH_UPLOAD) {
-       ldpp_dout(wk->get_lc(), 5)
-         << "ERROR: abort_multipart_upload failed, ret=" << ret
-         << wq->thr_name()
-         << ", meta:" << obj.key
-         << dendl;
-      }
+      int ret = abort_multipart_upload(store, cct, &rctx, bucket_info, mp_obj);
+      if (ret == 0) {
+        if (perfcounter) {
+          perfcounter->inc(l_rgw_lc_abort_mpu, 1);
+        }
+      } else {
+       if (ret == -ERR_NO_SUCH_UPLOAD) {
+         ldpp_dout(wk->get_lc(), 5)
+           << "ERROR: abort_multipart_upload failed, ret=" << ret
+           << wq->thr_name()
+           << ", meta:" << obj.key
+           << dendl;
+       } else {
+         ldpp_dout(wk->get_lc(), 0)
+           << "ERROR: abort_multipart_upload failed, ret=" << ret
+           << wq->thr_name()
+           << ", meta:" << obj.key
+           << dendl;
+       }
+      } /* abort failed */
     } /* expired */
   };
 
@@ -1087,6 +1089,9 @@ public:
                         << oc.wq->thr_name() << dendl;
        return r;
       }
+      if (perfcounter) {
+        perfcounter->inc(l_rgw_lc_expire_current, 1);
+      }
       ldout(oc.cct, 2) << "DELETED:" << oc.bucket_info.bucket << ":" << o.key
                       << " " << oc.wq->thr_name() << dendl;
     }
@@ -1132,6 +1137,9 @@ public:
                       << " " << oc.wq->thr_name() << dendl;
       return r;
     }
+    if (perfcounter) {
+      perfcounter->inc(l_rgw_lc_expire_noncurrent, 1);
+    }
     ldout(oc.cct, 2) << "DELETED:" << oc.bucket_info.bucket << ":" << o.key
                     << " (non-current expiration) "
                     << oc.wq->thr_name() << dendl;
@@ -1174,6 +1182,9 @@ public:
                       << dendl;
       return r;
     }
+    if (perfcounter) {
+      perfcounter->inc(l_rgw_lc_expire_dm, 1);
+    }
     ldout(oc.cct, 2) << "DELETED:" << oc.bucket_info.bucket << ":" << o.key
                     << " (delete marker expiration) "
                     << oc.wq->thr_name() << dendl;
@@ -1282,6 +1293,15 @@ protected:
 public:
   LCOpAction_CurrentTransition(const transition_action& _transition)
     : LCOpAction_Transition(_transition) {}
+    int process(lc_op_ctx& oc) {
+      int r = LCOpAction_Transition::process(oc);
+      if (r == 0) {
+        if (perfcounter) {
+          perfcounter->inc(l_rgw_lc_transition_current, 1);
+        }
+      }
+      return r;
+    }
 };
 
 class LCOpAction_NonCurrentTransition : public LCOpAction_Transition {
@@ -1298,6 +1318,15 @@ public:
                                  const transition_action& _transition)
     : LCOpAction_Transition(_transition)
     {}
+    int process(lc_op_ctx& oc) {
+      int r = LCOpAction_Transition::process(oc);
+      if (r == 0) {
+        if (perfcounter) {
+          perfcounter->inc(l_rgw_lc_transition_noncurrent, 1);
+        }
+      }
+      return r;
+    }
 };
 
 void LCOpRule::build()
@@ -1899,7 +1928,8 @@ void RGWLifecycleConfiguration::generate_test_instances(
   o.push_back(new RGWLifecycleConfiguration);
 }
 
-void get_lc_oid(CephContext *cct, const string& shard_id, string *oid)
+static inline void get_lc_oid(CephContext *cct,
+                             const string& shard_id, string *oid)
 {
   int max_objs =
     (cct->_conf->rgw_lc_max_objs > HASH_PRIME ? HASH_PRIME :
index 03209b7ea987d2ae58605a4cd10e767558a2ee5b..ff8be4c0efc529918e179f988798feae5d6fff7c 100644 (file)
@@ -473,6 +473,7 @@ public:
     WorkPool* workpool{nullptr};
 
   public:
+
     using lock_guard = std::lock_guard<std::mutex>;
     using unique_lock = std::unique_lock<std::mutex>;
 
index 951bf54fee7b26175ada432156c576fd85e0b8cb..3336c4855e044afb3ba2ec0b39327c102cf5072c 100644 (file)
@@ -35,7 +35,20 @@ int rgw_perf_start(CephContext *cct)
   plb.add_u64_counter(l_rgw_keystone_token_cache_miss, "keystone_token_cache_miss", "Keystone token cache miss");
 
   plb.add_u64_counter(l_rgw_gc_retire, "gc_retire_object", "GC object retires");
-  plb.add_u64_counter(l_rgw_lc_remove_expired, "lc_remove_expired", "LC removed objects");
+
+  plb.add_u64_counter(l_rgw_lc_expire_current, "lc_expire_current",
+                     "Lifecycle current expiration");
+  plb.add_u64_counter(l_rgw_lc_expire_noncurrent, "lc_expire_noncurrent",
+                     "Lifecycle non-current expiration");
+  plb.add_u64_counter(l_rgw_lc_expire_dm, "lc_expire_dm",
+                     "Lifecycle delete-marker expiration");
+  plb.add_u64_counter(l_rgw_lc_transition_current, "lc_transition_current",
+                     "Lifecycle current transition");
+  plb.add_u64_counter(l_rgw_lc_transition_noncurrent,
+                     "lc_transition_noncurrent",
+                     "Lifecycle non-current transition");
+  plb.add_u64_counter(l_rgw_lc_abort_mpu, "lc_abort_mpu",
+                     "Lifecycle abort multipart upload");
 
   plb.add_u64_counter(l_rgw_pubsub_event_triggered, "pubsub_event_triggered", "Pubsub events with at least one topic");
   plb.add_u64_counter(l_rgw_pubsub_event_lost, "pubsub_event_lost", "Pubsub events lost");
index e07a3d9897c2a27b817a57346d0af473b3c8c93f..a3c10d9a947d2671233e882a715245ffe44226d0 100644 (file)
@@ -32,7 +32,13 @@ enum {
   l_rgw_keystone_token_cache_miss,
 
   l_rgw_gc_retire,
-  l_rgw_lc_remove_expired,
+
+  l_rgw_lc_expire_current,
+  l_rgw_lc_expire_noncurrent,
+  l_rgw_lc_expire_dm,
+  l_rgw_lc_transition_current,
+  l_rgw_lc_transition_noncurrent,
+  l_rgw_lc_abort_mpu,
 
   l_rgw_pubsub_event_triggered,
   l_rgw_pubsub_event_lost,