]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/rados: calculate_preferred_shards takes bool is_versioned 60403/head
authorCasey Bodley <cbodley@redhat.com>
Wed, 12 Feb 2025 17:35:37 +0000 (12:35 -0500)
committerCasey Bodley <cbodley@redhat.com>
Wed, 5 Mar 2025 16:12:44 +0000 (11:12 -0500)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/driver/rados/rgw_rados.cc
src/rgw/driver/rados/rgw_rados.h
src/rgw/driver/rados/rgw_reshard.cc

index cbbdab282d69c67fdacdca398059f484f063c70c..9dff93ca06f10ec711a1b7500629da24fe39dd38 100644 (file)
@@ -10815,7 +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,
+                                         bool is_versioned,
                                          const uint64_t num_objs,
                                          const uint32_t num_source_shards,
                                          const uint32_t min_layout_shards,
@@ -10827,7 +10827,7 @@ void RGWRados::calculate_preferred_shards(const DoutPrefixProvider* dpp,
   uint64_t max_objs_per_shard =
     cct->_conf.get_val<uint64_t>("rgw_max_objs_per_shard");
 
-  if (bucket_info.versioned()) {
+  if (is_versioned) {
     // 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.
@@ -10870,12 +10870,13 @@ int RGWRados::check_bucket_shards(const RGWBucketInfo& bucket_info,
 
   bool need_resharding = false;
   uint32_t suggested_num_shards = 0;
+  const bool is_versioned = bucket_info.versioned();
   const uint32_t num_source_shards =
     rgw::current_num_shards(bucket_info.layout);
   const uint32_t min_layout_shards =
     rgw::current_min_layout_shards(bucket_info.layout);
 
-  calculate_preferred_shards(dpp, bucket_info, num_objs,
+  calculate_preferred_shards(dpp, is_versioned, num_objs,
                             num_source_shards, min_layout_shards,
                             need_resharding, &suggested_num_shards);
   if (! need_resharding) {
index 27c44a8ce6ec7057607e7f9c79b8648ac24c66a6..e7272c5b375fad02b42f2ab12a74cc77f60cddc5 100644 (file)
@@ -1628,7 +1628,7 @@ public:
                  optional_yield y, bool check_size_only = false);
 
   void calculate_preferred_shards(const DoutPrefixProvider* dpp,
-                                 const RGWBucketInfo& bucket_info,
+                                 bool is_versioned,
                                  const uint64_t num_objs,
                                  const uint32_t current_shard_count,
                                  const uint32_t min_layout_shards,
index f9819d514b18d80e6d2ac94d18a6943abc42476b..d4999b361985434ed71fc6ad598229cd59185a01 100644 (file)
@@ -1642,6 +1642,7 @@ int RGWReshard::process_entry(const cls_rgw_reshard_entry& entry,
       num_entries += s.second.num_objects;
     }
 
+    const bool is_versioned = bucket_info.versioned();
     const uint32_t current_shard_count =
       rgw::current_num_shards(bucket_info.layout);
     const uint32_t min_layout_shards =
@@ -1653,7 +1654,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, bucket_info, num_entries, current_shard_count, min_layout_shards,
+      dpp, is_versioned, num_entries, current_shard_count, min_layout_shards,
       needs_resharding, &suggested_shard_count);
 
     // if we no longer need resharding or currently need to expand