/* resharding tunables */
OPTION(rgw_reshard_max_jobs, OPT_INT, 1024)
OPTION(rgw_reshard_bucket_lock_duration, OPT_INT, 120) // duration of lock on bucket obj during resharding
+OPTION(rgw_dynamic_resharding, OPT_BOOL, true)
+OPTION(rgw_max_objs_per_shard, OPT_INT, 100000)
bucket_stats_cache.adjust_stats(user, bucket, obj_delta, added_bytes, removed_bytes);
user_stats_cache.adjust_stats(user, bucket, obj_delta, added_bytes, removed_bytes);
}
+
+ int check_bucket_shards(uint64_t max_objs_per_shard, uint64_t num_shards,
+ const rgw_user& user, rgw_bucket& bucket, RGWQuotaInfo& bucket_quota,
+ uint64_t num_objs, bool& need_resharding)
+ {
+ RGWStorageStats bucket_stats;
+ int ret = bucket_stats_cache.get_stats(user, bucket, bucket_stats,
+ bucket_quota);
+ if (ret < 0) {
+ return ret;
+ }
+
+ if (bucket_stats.num_objects + num_objs > num_shards * max_objs_per_shard) {
+ dout(10) << "resharding needed: stats.num_objects=" << bucket_stats.num_objects
+ << " shard max_objects=" << max_objs_per_shard * num_shards << dendl;
+ need_resharding = true;
+ } else {
+ need_resharding = false;
+ }
+
+ return 0;
+ }
+
};
{
delete handler;
}
+
+
RGWQuotaInfo& user_quota, RGWQuotaInfo& bucket_quota,
uint64_t num_objs, uint64_t size) = 0;
+ virtual int check_bucket_shards(uint64_t max_objs_per_shard, uint64_t num_shards,
+ const rgw_user& bucket_owner, rgw_bucket& bucket,
+ RGWQuotaInfo& bucket_quota, uint64_t num_objs, bool& need_resharding) = 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;
static RGWQuotaHandler *generate_handler(RGWRados *store, bool quota_threads);
return 0;
}
+int RGWRados::check_bucket_shards(const rgw_user& bucket_owner, rgw_bucket& bucket,
+ RGWQuotaInfo& bucket_quota, uint64_t num_shards, bool& need_resharding)
+{
+ if (!cct->_conf->rgw_dynamic_resharding) {
+ return 0;
+ }
+
+ return quota_handler->check_bucket_shards((uint64_t)cct->_conf->rgw_max_objs_per_shard, num_shards,
+ bucket_owner, bucket, bucket_quota, 1, need_resharding);
+}
+
+
int RGWRados::check_quota(const rgw_user& bucket_owner, rgw_bucket& bucket,
RGWQuotaInfo& user_quota, RGWQuotaInfo& bucket_quota, uint64_t obj_size)
{
int check_quota(const rgw_user& bucket_owner, rgw_bucket& bucket,
RGWQuotaInfo& user_quota, RGWQuotaInfo& bucket_quota, uint64_t obj_size);
+ int check_bucket_shards(const rgw_user& bucket_owner, rgw_bucket& bucket,
+ RGWQuotaInfo& bucket_quota, uint64_t num_shards,
+ bool& need_resharding);
+
uint64_t instance_id();
const string& zone_id() {
return get_zone_params().get_id();