]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: trigger resharding of versioned buckets sooner
authorMykola Golub <mykola.golub@clyso.com>
Sat, 19 Oct 2024 10:49:06 +0000 (11:49 +0100)
committerCasey Bodley <cbodley@redhat.com>
Wed, 5 Mar 2025 16:12:44 +0000 (11:12 -0500)
Versioned buckets require more keys per object.

Fixes: https://tracker.ceph.com/issues/68206
Signed-off-by: Mykola Golub <mykola.golub@clyso.com>
src/rgw/driver/rados/rgw_rados.cc
src/rgw/driver/rados/rgw_rados.h
src/rgw/driver/rados/rgw_reshard.cc

index a55d67aff5bbe14662c784d6cf3e2490e95fb1c4..d2abdb76c988e7ccb9c2089211c9f5d27e69e911 100644 (file)
@@ -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<uint64_t>("rgw_max_dynamic_shards"));
-  const uint64_t max_objs_per_shard =
+  uint64_t max_objs_per_shard =
     cct->_conf.get_val<uint64_t>("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) {
index 8c65646615f23202a2569e646c816ea348de81ba..27c44a8ce6ec7057607e7f9c79b8648ac24c66a6 100644 (file)
@@ -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,
index 429b209bbac271ffe8fce4ed544c02cc7b152e12..f9819d514b18d80e6d2ac94d18a6943abc42476b 100644 (file)
@@ -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