]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: trigger resharding of versioned buckets sooner 63598/head
authorJ. Eric Ivancich <ivancich@redhat.com>
Thu, 29 May 2025 19:50:13 +0000 (15:50 -0400)
committerJ. Eric Ivancich <ivancich@redhat.com>
Thu, 29 May 2025 19:50:13 +0000 (15:50 -0400)
Versioned buckets require more keys per object. So influence the
calculation of whether resharding is needed by using a lower
max_objs_per_shard value for versioned buckets.

Signed-off-by: J. Eric Ivancich <ivancich@redhat.com>
src/rgw/driver/rados/rgw_rados.cc
src/rgw/rgw_quota.cc
src/rgw/rgw_quota.h

index d36144741e3f3a48c68fb786092fc2721354b4dd..e23a17c2f154f43c1cd095891482c9b494d3b417 100644 (file)
@@ -10123,10 +10123,12 @@ int RGWRados::check_bucket_shards(const RGWBucketInfo& bucket_info,
 
   // TODO: consider per-bucket sync policy here?
   const bool is_multisite = svc.zone->need_to_log_data();
+  const bool is_versioned = bucket_info.versioned();
 
-  quota_handler->check_bucket_shards(dpp, max_objs_per_shard, num_source_shards,
-                                    num_objs, is_multisite, need_resharding,
-                                    &suggested_num_shards);
+  quota_handler->check_bucket_shards(dpp, max_objs_per_shard,
+                                    num_source_shards, num_objs,
+                                    is_multisite, is_versioned,
+                                    need_resharding, &suggested_num_shards);
   if (! need_resharding) {
     return 0;
   }
index f1ae34f9368092440f2d9ec9882ae9e1e740f72f..d487613d526f879b88bca8d3ca3cecd298c09062 100644 (file)
@@ -963,9 +963,18 @@ public:
   }
 
   void check_bucket_shards(const DoutPrefixProvider *dpp, uint64_t max_objs_per_shard,
-                           uint64_t num_shards, uint64_t num_objs, bool is_multisite,
-                           bool& need_resharding, uint32_t *suggested_num_shards) override
+                          uint64_t num_shards, uint64_t num_objs,
+                          bool is_multisite, bool is_versioned,
+                          bool& need_resharding, uint32_t *suggested_num_shards) override
   {
+    if (is_versioned) {
+      // since versioned buckets have multiple entries per version of
+      // an object, reduce maximum to try to account for this
+      constexpr uint64_t min_max_objs_per_shard = 1;
+      max_objs_per_shard = std::max(min_max_objs_per_shard,
+                                   max_objs_per_shard / 3);
+    }
+
     if (num_objs > num_shards * max_objs_per_shard) {
       ldpp_dout(dpp, 0) << __func__ << ": resharding needed: stats.num_objects=" << num_objs
              << " shard max_objects=" <<  max_objs_per_shard * num_shards << dendl;
index 632cb48171b2532712f8f7b67f8a57d0ef5d96e4..33d014b00c95fb4869f7eed25476adc1d7c3426b 100644 (file)
@@ -35,8 +35,9 @@ public:
                          uint64_t num_objs, uint64_t size, optional_yield y) = 0;
 
   virtual void check_bucket_shards(const DoutPrefixProvider *dpp, uint64_t max_objs_per_shard,
-                                   uint64_t num_shards, uint64_t num_objs, bool is_multisite,
-                                   bool& need_resharding, uint32_t *suggested_num_shards) = 0;
+                                  uint64_t num_shards, uint64_t num_objs,
+                                  bool is_multisite, bool is_versioned,
+                                  bool& need_resharding, uint32_t *suggested_num_shards) = 0;
 
   virtual void update_stats(const rgw_user& bucket_owner, rgw_bucket& bucket, int obj_delta, uint64_t added_bytes, uint64_t removed_bytes) = 0;