]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix bad versioned bucket stats after reshard
authorJ. Eric Ivancich <ivancich@redhat.com>
Thu, 29 Nov 2018 23:02:45 +0000 (18:02 -0500)
committerPrashant D <pdhange@redhat.com>
Sun, 26 May 2019 23:56:12 +0000 (19:56 -0400)
When a versioned bucket is resharded, the stats for bucket index
entries of type PlainIdx and InstanceIdx were both accumulated to
determine the bucket stats. This caused a doubling of some stats, such
as bytes used. This fix makes certain that only PlainIdx entries are
accumulated. This works for unversioned buckets as well, as they only
have Plain Idx entries.

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

src/cls/rgw/cls_rgw_types.cc

index cbcc47525739e0369a33defa0b3374519b14493a..c48a2b353cf5e80b437d12c16a449b3ea24fa72e 100644 (file)
@@ -247,6 +247,8 @@ bool rgw_cls_bi_entry::get_info(cls_rgw_obj_key *key, uint8_t *category, rgw_buc
   using ceph::decode;
   switch (type) {
     case PlainIdx:
+        account = true;
+        // NO BREAK; falls through to case InstanceIdx:
     case InstanceIdx:
       {
         rgw_bucket_dir_entry entry;
@@ -257,7 +259,6 @@ bool rgw_cls_bi_entry::get_info(cls_rgw_obj_key *key, uint8_t *category, rgw_buc
         accounted_stats->total_size += entry.meta.accounted_size;
         accounted_stats->total_size_rounded += cls_rgw_get_rounded_size(entry.meta.accounted_size);
         accounted_stats->actual_size += entry.meta.size;
-        account = true;
       }
       break;
     case OLHIdx: