From: Abhishek Lekshmanan Date: Fri, 5 Oct 2018 09:19:18 +0000 (+0200) Subject: rgw: copy actual stats from the source shards during reshard X-Git-Tag: v13.2.3~144^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F24526%2Fhead;p=ceph.git rgw: copy actual stats from the source shards during reshard Currently we don't copy the actual_stats field during reshard, which makes resharded buckets show a size_utilized as 0, which further has the problem that a subsequent object removal would subtract the object size from the 0 size utilized showing up large uint64_t values. Copy the size_actual from the source object in both cls and in reshard_process. This will fix the new buckets, existing buckets will still have to go through a bucket check --fix for their stats to be corrected. Fixes: http://tracker.ceph.com/issues/36290 Signed-off-by: Abhishek Lekshmanan (cherry picked from commit beb90638ae3d5329653b61bae0d6714796c41d04) --- diff --git a/src/cls/rgw/cls_rgw.cc b/src/cls/rgw/cls_rgw.cc index 64e31cdce95d..9dfa477ab999 100644 --- a/src/cls/rgw/cls_rgw.cc +++ b/src/cls/rgw/cls_rgw.cc @@ -597,6 +597,7 @@ int rgw_bucket_update_stats(cls_method_context_t hctx, bufferlist *in, bufferlis dest.total_size += s.second.total_size; dest.total_size_rounded += s.second.total_size_rounded; dest.num_entries += s.second.num_entries; + dest.actual_size += s.second.actual_size; } } diff --git a/src/cls/rgw/cls_rgw_types.cc b/src/cls/rgw/cls_rgw_types.cc index 788058288868..cbcc47525739 100644 --- a/src/cls/rgw/cls_rgw_types.cc +++ b/src/cls/rgw/cls_rgw_types.cc @@ -256,6 +256,7 @@ bool rgw_cls_bi_entry::get_info(cls_rgw_obj_key *key, uint8_t *category, rgw_buc accounted_stats->num_entries++; 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; diff --git a/src/rgw/rgw_reshard.cc b/src/rgw/rgw_reshard.cc index cde521ff7dc4..c95ab7e4728b 100644 --- a/src/rgw/rgw_reshard.cc +++ b/src/rgw/rgw_reshard.cc @@ -83,6 +83,7 @@ public: target.num_entries += entry_stats.num_entries; target.total_size += entry_stats.total_size; target.total_size_rounded += entry_stats.total_size_rounded; + target.actual_size += entry_stats.actual_size; } if (entries.size() >= RESHARD_SHARD_WINDOW) { int ret = flush();