From: Mykola Golub Date: Sat, 19 Oct 2024 10:49:06 +0000 (+0100) Subject: rgw: trigger resharding of versioned buckets sooner X-Git-Tag: v20.3.0~408^2~2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=b45f65615d3415b90b48efdb1c4d2c3995316582;p=ceph.git rgw: trigger resharding of versioned buckets sooner Versioned buckets require more keys per object. Fixes: https://tracker.ceph.com/issues/68206 Signed-off-by: Mykola Golub --- diff --git a/src/rgw/driver/rados/rgw_rados.cc b/src/rgw/driver/rados/rgw_rados.cc index a55d67aff5bbe..d2abdb76c988e 100644 --- a/src/rgw/driver/rados/rgw_rados.cc +++ b/src/rgw/driver/rados/rgw_rados.cc @@ -10815,6 +10815,7 @@ int RGWRados::cls_bucket_head_async(const DoutPrefixProvider *dpp, const RGWBuck // uses information that the store has easy access to transition to the shard calculatoin logic void RGWRados::calculate_preferred_shards(const DoutPrefixProvider* dpp, + const RGWBucketInfo& bucket_info, const uint64_t num_objs, const uint32_t num_source_shards, const uint32_t min_layout_shards, @@ -10823,8 +10824,16 @@ void RGWRados::calculate_preferred_shards(const DoutPrefixProvider* dpp, { const uint32_t max_dynamic_shards = uint32_t(cct->_conf.get_val("rgw_max_dynamic_shards")); - const uint64_t max_objs_per_shard = + uint64_t max_objs_per_shard = cct->_conf.get_val("rgw_max_objs_per_shard"); + + if (bucket_info.versioning_enabled()) { + // Since each versioned bucket requires 4 entries for the first object + // and 2 additional entries for each additional object, we want to + // trigger resharding sooner. + max_objs_per_shard /= 3; + } + const bool is_multisite = svc.zone->need_to_log_data(); RGWBucketReshard::calculate_preferred_shards(dpp, @@ -10866,7 +10875,7 @@ int RGWRados::check_bucket_shards(const RGWBucketInfo& bucket_info, const uint32_t min_layout_shards = rgw::current_min_layout_shards(bucket_info.layout); - calculate_preferred_shards(dpp, num_objs, + calculate_preferred_shards(dpp, bucket_info, num_objs, num_source_shards, min_layout_shards, need_resharding, &suggested_num_shards); if (! need_resharding) { diff --git a/src/rgw/driver/rados/rgw_rados.h b/src/rgw/driver/rados/rgw_rados.h index 8c65646615f23..27c44a8ce6ec7 100644 --- a/src/rgw/driver/rados/rgw_rados.h +++ b/src/rgw/driver/rados/rgw_rados.h @@ -1628,6 +1628,7 @@ public: optional_yield y, bool check_size_only = false); void calculate_preferred_shards(const DoutPrefixProvider* dpp, + const RGWBucketInfo& bucket_info, const uint64_t num_objs, const uint32_t current_shard_count, const uint32_t min_layout_shards, diff --git a/src/rgw/driver/rados/rgw_reshard.cc b/src/rgw/driver/rados/rgw_reshard.cc index 429b209bbac27..f9819d514b18d 100644 --- a/src/rgw/driver/rados/rgw_reshard.cc +++ b/src/rgw/driver/rados/rgw_reshard.cc @@ -1653,7 +1653,7 @@ int RGWReshard::process_entry(const cls_rgw_reshard_entry& entry, // needed to perform the calculation before calling // calculating_preferred_shards() in this class store->getRados()->calculate_preferred_shards( - dpp, num_entries, current_shard_count, min_layout_shards, + dpp, bucket_info, num_entries, current_shard_count, min_layout_shards, needs_resharding, &suggested_shard_count); // if we no longer need resharding or currently need to expand