]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: perfcounters: add gc retire counter 29308/head
authorMatt Benjamin <mbenjamin@redhat.com>
Sat, 9 Feb 2019 20:44:08 +0000 (15:44 -0500)
committerNathan Cutler <ncutler@suse.com>
Thu, 25 Jul 2019 10:16:38 +0000 (12:16 +0200)
To avoid spam, counter updates are batched with the corresponding log
trim chunks.

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

Conflicts:
src/rgw/rgw_gc.cc
- no "rgw_tools.h" include in nautilus

src/rgw/rgw_common.h
src/rgw/rgw_gc.cc
src/rgw/rgw_perf_counters.cc
src/rgw/rgw_perf_counters.h

index a7347a473cba33e7f4b71a6ee5d6b65c931c95e3..07d6e802c4e608f2f5a73219e08589556b020678 100644 (file)
@@ -247,7 +247,7 @@ struct req_state;
 
 typedef void *RGWAccessHandle;
 
- /* size should be the required string size + 1 */
+/* size should be the required string size + 1 */
 int gen_rand_base64(CephContext *cct, char *dest, int size);
 void gen_rand_alphanumeric(CephContext *cct, char *dest, int size);
 void gen_rand_alphanumeric_lower(CephContext *cct, char *dest, int size);
index 6ebce7f6023e548d63861ac7c10d237e57e5c430..8167c8e7af442ad377b910eb065c67b3b5a0221f 100644 (file)
@@ -2,13 +2,16 @@
 // vim: ts=8 sw=2 smarttab
 
 #include "rgw_gc.h"
+
+#include "include/scope_guard.h"
 #include "include/rados/librados.hpp"
 #include "cls/rgw/cls_rgw_client.h"
 #include "cls/refcount/cls_refcount_client.h"
+#include "rgw_perf_counters.h"
 #include "cls/lock/cls_lock_client.h"
 #include "include/random.h"
 
-#include <list>
+#include <list> // XXX
 #include <sstream>
 
 #define dout_context g_ceph_context
@@ -254,8 +257,14 @@ public:
       " removing entries from gc log shard index=" << index << ", size=" <<
       rt.size() << ", entries=" << rt << dendl;
 
+    auto rt_guard = make_scope_guard(
+      [&]
+       {
+         rt.clear();
+       }
+      );
+
     int ret = gc->remove(index, rt, &index_io.c);
-    rt.clear();
     if (ret < 0) {
       /* we already cleared list of tags, this prevents us from
        * ballooning in case of a persistent problem
@@ -264,7 +273,10 @@ public:
        index << " ret=" << ret << dendl;
       return;
     }
-
+    if (perfcounter) {
+      /* log the count of tags retired for rate estimation */
+      perfcounter->inc(l_rgw_gc_retire, rt.size());
+    }
     ios.push_back(index_io);
   }
 
index f5c3f8746ce987955bf12eba6232a209a4b10f23..1a5519e6478775f59b0a92ba1bf6a6967905a80b 100644 (file)
@@ -34,6 +34,8 @@ int rgw_perf_start(CephContext *cct)
   plb.add_u64_counter(l_rgw_keystone_token_cache_hit, "keystone_token_cache_hit", "Keystone token cache hits");
   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_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");
   plb.add_u64_counter(l_rgw_pubsub_store_ok, "pubsub_store_ok", "Pubsub events successfully stored");
index f119508b9896c8b5c13144c7e89cc98dd43b5544..254cd724ab47f5f358e1494f881764fa279e4c30 100644 (file)
@@ -33,6 +33,8 @@ enum {
   l_rgw_keystone_token_cache_hit,
   l_rgw_keystone_token_cache_miss,
 
+  l_rgw_gc_retire,
+
   l_rgw_pubsub_event_triggered,
   l_rgw_pubsub_event_lost,
   l_rgw_pubsub_store_ok,