]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: perfcounters: add gc retire counter 30073/head
authorMatt Benjamin <mbenjamin@redhat.com>
Sat, 9 Feb 2019 20:44:08 +0000 (15:44 -0500)
committerNathan Cutler <ncutler@suse.com>
Tue, 1 Oct 2019 12:37:33 +0000 (14:37 +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_common.h
src/rgw/rgw_gc.cc
src/rgw/rgw_perf_counters.cc
src/rgw/rgw_perf_counters.h
- no "rgw_perf_counters.{cc,h}" in mimic; made the changes in rgw_common.{cc,h}
  instead

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

index 415d0f10637d15061cf0e8df9d2f39bbe0ff2b51..c30b6af20bcfd1de52533cf862ed1c02d96208cf 100644 (file)
@@ -164,6 +164,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");
+
   perfcounter = plb.create_perf_counters();
   cct->get_perfcounters_collection()->add(perfcounter);
   return 0;
index 743a45de7db99d4732df8de998c4b7c86279b11e..53ce38816e96239bea3a7b32b56c3d34c4470b3a 100644 (file)
@@ -262,11 +262,13 @@ enum {
   l_rgw_keystone_token_cache_hit,
   l_rgw_keystone_token_cache_miss,
 
+  l_rgw_gc_retire,
+
   l_rgw_last,
 };
 
 
- /* 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 52c3b8ea28268c8519f19cd4b686cf5c7add5c19..c7bb945e2d69138a94e69ec1cf43d6fe2265500c 100644 (file)
@@ -2,13 +2,15 @@
 // 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 "cls/lock/cls_lock_client.h"
 #include "include/random.h"
 
-#include <list>
+#include <list> // XXX
 #include <sstream>
 
 #define dout_context g_ceph_context
@@ -270,8 +272,14 @@ public:
       " removing entries from gc log shard index=" << index << ", size=" <<
       rt.size() << ", entries=[" << lister() << "]" << 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
@@ -280,7 +288,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);
   }