// 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;
}
}
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;
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;