]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: make sure max_objs_per_shard is appropriate in debugging scenarios
authorJ. Eric Ivancich <ivancich@redhat.com>
Thu, 22 May 2025 20:15:56 +0000 (16:15 -0400)
committerCasey Bodley <cbodley@redhat.com>
Mon, 23 Jun 2025 16:06:19 +0000 (12:06 -0400)
When we have a versioned bucket, we reduce max_objs_per_shard by a
factor of 3 to account for the extra bucket index entries required in
such buckets. And during debugging, we may want to induce early
resharding by setting max_objs_per_shard to an artificially low
value. Combined, that math could result in max_objs_per_shard with a
value of 0 that would cause a division by zero crash. This fixes that.

Signed-off-by: J. Eric Ivancich <ivancich@redhat.com>
(cherry picked from commit 27f9c103f1a98b78b9bd58d0e669d557c3851702)

Conflicts:
src/rgw/driver/rados/rgw_rados.cc
  calculate_preferred_shards() changes from #57538 not on squid

src/rgw/driver/rados/rgw_rados.cc

index c3fe6ce24c379865e625c3f8774bb59eeed41869..cf35bf54ab7c0ab0981d70181eaeec16117450ce 100644 (file)
@@ -10522,6 +10522,10 @@ int RGWRados::check_bucket_shards(const RGWBucketInfo& bucket_info,
     max_objs_per_shard /= 3;
   }
 
+  // make sure it's at least 1, as in some testing scenarios it's artificially low
+  constexpr uint64_t min_max_objs_per_shard = 1;
+  max_objs_per_shard = std::max(min_max_objs_per_shard, max_objs_per_shard);
+
   // TODO: consider per-bucket sync policy here?
   const bool is_multisite = svc.zone->need_to_log_data();