]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: user stats showing 0 value for "size_utilized" and "size_kb_utilized" fields 44172/head
authorJ. Eric Ivancich <ivancich@redhat.com>
Wed, 28 Jul 2021 17:52:29 +0000 (13:52 -0400)
committerCory Snyder <csnyder@iland.com>
Wed, 1 Dec 2021 20:10:29 +0000 (15:10 -0500)
When accumulating user stats, the "utilized" fields are not looked
at. Updates RGWStorageStats::dump so it only outputs the "utilized"
data if they're updated.

Signed-off-by: J. Eric Ivancich <ivancich@redhat.com>
(cherry picked from commit 248fbce6b54f6c91e63b05861f8631ca64c8df81)

Conflicts:
src/rgw/rgw_admin.cc

Cherry-pick notes:
- Conflicts due to change of interface for rgw user and rados store

src/rgw/rgw_admin.cc
src/rgw/rgw_common.h
src/rgw/rgw_json_enc.cc

index a922182571d0bd324964442d8aaeb62635b016ce..9d3d8351e68d750a40e8d538afdd49a9563b2e16 100644 (file)
@@ -7499,7 +7499,8 @@ next:
       }
     }
 
-    RGWStorageStats stats;
+    constexpr bool omit_utilized_stats = false;
+    RGWStorageStats stats(omit_utilized_stats);
     ceph::real_time last_stats_sync;
     ceph::real_time last_stats_update;
     int ret = store->ctl()->user->read_stats(user_id, &stats, &last_stats_sync, &last_stats_update);
index 2c8d742b93d43f9368ab03aeb30165175b4b852c..a5cfb3c41a811431cfdd78861cf10f1e511c7b23 100644 (file)
@@ -14,8 +14,7 @@
  * 
  */
 
-#ifndef CEPH_RGW_COMMON_H
-#define CEPH_RGW_COMMON_H
+#pragma once
 
 #include <array>
 
@@ -1250,17 +1249,20 @@ struct RGWStorageStats
   RGWObjCategory category;
   uint64_t size;
   uint64_t size_rounded;
-  uint64_t size_utilized{0}; //< size after compression, encryption
   uint64_t num_objects;
+  uint64_t size_utilized{0}; //< size after compression, encryption
+  bool dump_utilized;        // whether dump should include utilized values
 
-  RGWStorageStats()
+  RGWStorageStats(bool _dump_utilized=true)
     : category(RGWObjCategory::None),
       size(0),
       size_rounded(0),
-      num_objects(0) {}
+      num_objects(0),
+      dump_utilized(_dump_utilized)
+  {}
 
   void dump(Formatter *f) const;
-};
+}; // RGWStorageStats
 
 class RGWEnv;
 
@@ -2453,5 +2455,3 @@ int decode_bl(bufferlist& bl, T& t)
   }
   return 0;
 }
-
-#endif
index bce7817e45d4761703b1550e70f7f75d7e1b5054..64af88cf9be4511a6c3ea3f88146698567ecac1a 100644 (file)
@@ -683,10 +683,14 @@ void RGWStorageStats::dump(Formatter *f) const
 {
   encode_json("size", size, f);
   encode_json("size_actual", size_rounded, f);
-  encode_json("size_utilized", size_utilized, f);
+  if (dump_utilized) {
+    encode_json("size_utilized", size_utilized, f);
+  }
   encode_json("size_kb", rgw_rounded_kb(size), f);
   encode_json("size_kb_actual", rgw_rounded_kb(size_rounded), f);
-  encode_json("size_kb_utilized", rgw_rounded_kb(size_utilized), f);
+  if (dump_utilized) {
+    encode_json("size_kb_utilized", rgw_rounded_kb(size_utilized), f);
+  }
   encode_json("num_objects", num_objects, f);
 }