]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
os: introduce ObjectStore::refresh_perf_counters() method.
authorIgor Fedotov <igor.fedotov@croit.io>
Wed, 25 Oct 2023 13:15:37 +0000 (16:15 +0300)
committerIgor Fedotov <igor.fedotov@croit.io>
Wed, 10 Jan 2024 18:26:47 +0000 (21:26 +0300)
This is a common method to refresh Object Store performance counters.

Signed-off-by: Igor Fedotov <igor.fedotov@croit.io>
(cherry picked from commit 8f5d61df634e839b5b2c8ab223c5c5fa2c0c1dda)

src/os/ObjectStore.h
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h
src/os/kstore/KStore.h
src/os/memstore/MemStore.h

index 4c837b84d01074ff33ce8317aeff37e0a3b9cb82..302be387fae6e62a7f303e9ff06f530d9d26ec35 100644 (file)
@@ -111,6 +111,13 @@ public:
    * This appears to be called with nothing locked.
    */
   virtual objectstore_perf_stat_t get_cur_stats() = 0;
+  /**
+   * Propagate Object Store performance counters with the actual values
+   *
+   *
+   * Intended primarily for testing purposes
+   */
+  virtual void refresh_perf_counters() = 0;
 
   /**
    * Fetch Object Store performance counters.
index aa14d0204f7aaad4f52b0f855a33def65b2b56eb..ce3462dbb04625a026f57b92952e96072be0bce4 100644 (file)
@@ -1312,6 +1312,7 @@ struct LruBufferCacheShard : public BlueStore::BufferCacheShard {
                  uint64_t *blobs,
                  uint64_t *buffers,
                  uint64_t *bytes) override {
+    std::lock_guard l(lock);
     *extents += num_extents;
     *blobs += num_blobs;
     *buffers += num;
@@ -1617,6 +1618,7 @@ public:
                  uint64_t *blobs,
                  uint64_t *buffers,
                  uint64_t *bytes) override {
+    std::lock_guard l(lock);
     *extents += num_extents;
     *blobs += num_blobs;
     *buffers += num;
@@ -4330,7 +4332,7 @@ void *BlueStore::MempoolThread::entry()
     _resize_shards(interval_stats_trim);
     interval_stats_trim = false;
 
-    store->_update_logger();
+    store->refresh_perf_counters();
     auto wait = ceph::make_timespan(
       store->cct->_conf->bluestore_cache_trim_interval);
     cond.wait_for(l, wait);
@@ -10667,7 +10669,7 @@ void BlueStore::_reap_collections()
   }
 }
 
-void BlueStore::_update_logger()
+void BlueStore::refresh_perf_counters()
 {
   uint64_t num_onodes = 0;
   uint64_t num_pinned_onodes = 0;
index c3d014dc938048006cc7cc39e8740f3e81780dcb..448cd3df9744a0bd65ba55b32d057beeadc7b43c 100644 (file)
@@ -2699,7 +2699,6 @@ private:
   CollectionRef _get_collection_by_oid(const ghobject_t& oid);
   void _queue_reap_collection(CollectionRef& c);
   void _reap_collections();
-  void _update_logger();
 
   void _assign_nid(TransContext *txc, OnodeRef& o);
   uint64_t _assign_blobid(TransContext *txc);
@@ -3244,6 +3243,8 @@ public:
   const PerfCounters* get_perf_counters() const override {
     return logger;
   }
+  void refresh_perf_counters() override;
+
   const PerfCounters* get_bluefs_perf_counters() const {
     return bluefs->get_perf_counters();
   }
index 9e3c7acd73b428880a6330445879436acd54325b..96bbdfaa424d1473cc25c28b532e803e6982b29b 100644 (file)
@@ -562,6 +562,8 @@ public:
   objectstore_perf_stat_t get_cur_stats() override {
     return objectstore_perf_stat_t();
   }
+  void refresh_perf_counters() override {
+  }
   const PerfCounters* get_perf_counters() const override {
     return logger;
   }
index 858379ed9c7c4575572340be2e35127f65fd5fd1..2abe552891fd1f803d80036f6fd29151912354cc 100644 (file)
@@ -395,7 +395,8 @@ public:
   }
 
   objectstore_perf_stat_t get_cur_stats() override;
-
+  void refresh_perf_counters() override {
+  }
   const PerfCounters* get_perf_counters() const override {
     return nullptr;
   }