user_stats_cache.adjust_stats(user, bucket, obj_delta, added_bytes, removed_bytes);
}
- void check_bucket_shards(const DoutPrefixProvider *dpp, uint64_t max_objs_per_shard, uint64_t num_shards,
- uint64_t num_objs, bool& need_resharding, uint32_t *suggested_num_shards) override
+ 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
{
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;
need_resharding = true;
if (suggested_num_shards) {
- *suggested_num_shards = num_objs * 2 / max_objs_per_shard;
+ uint32_t obj_multiplier = 2;
+ if (is_multisite) {
+ // if we're maintaining bilogs for multisite, reshards are significantly
+ // more expensive. scale up the shard count much faster to minimize the
+ // number of reshard events during a write workload
+ obj_multiplier = 8;
+ }
+ *suggested_num_shards = num_objs * obj_multiplier / max_objs_per_shard;
}
} else {
need_resharding = false;
RGWQuota& quota,
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& need_resharding, uint32_t *suggested_num_shards) = 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;
virtual void update_stats(const rgw_user& bucket_owner, rgw_bucket& bucket, int obj_delta, uint64_t added_bytes, uint64_t removed_bytes) = 0;
const uint64_t max_objs_per_shard =
cct->_conf.get_val<uint64_t>("rgw_max_objs_per_shard");
+ // TODO: consider per-bucket sync policy here?
+ const bool is_multisite = svc.zone->get_zone().log_data;
+
quota_handler->check_bucket_shards(dpp, max_objs_per_shard, num_source_shards,
- num_objs, need_resharding, &suggested_num_shards);
+ num_objs, is_multisite, need_resharding,
+ &suggested_num_shards);
if (! need_resharding) {
return 0;
}