]> 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 44171/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:07:34 +0000 (15:07 -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 interfaces for user and store

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

index e49e1de819e85fc7b6a00d99f60a8f959aeb5ec7..da23c655801858473893f8648e67fb119a0fd13b 100644 (file)
@@ -7536,7 +7536,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(dpp(), user_id, &stats, null_yield,
index 41413b077bb31f3d84f79ebf0a8d2eebab875f81..50e4ddb968f742417bd5cbae5445afc43eeb3ddb 100644 (file)
@@ -14,8 +14,7 @@
  * 
  */
 
-#ifndef CEPH_RGW_COMMON_H
-#define CEPH_RGW_COMMON_H
+#pragma once
 
 #include <array>
 #include <string_view>
@@ -1121,17 +1120,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;
 
@@ -2328,5 +2330,3 @@ int decode_bl(bufferlist& bl, T& t)
   }
   return 0;
 }
-
-#endif
index b3ceff68e757062a37b88944e53e728ebfa451f5..d8d14bb2f2cdf7ea6cf8abdc9d4f71ca70e70e76 100644 (file)
@@ -686,10 +686,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);
 }